Googleアナリティクス

2017年8月7日月曜日

Start VM with LogicApps ARM Connector

Original Post is here.

With the previous update, Azure Resource Manager can also use the service principal for authenticating the connector, authentication can be done on a per-application basis without creating an account for it, There is a convenient case that you do not need to think for each user when you want to do it. In this time, I tried to activate the VM using the function in it.

There are various ways to start the VM, using Automation or directly hitting REST Api, but I personally think that it is the easiest way to use LogicFlow 's ARM connector .

The ARM connector has an action called Invoke resource operation, which can directly call the operation (Action) of the resource provider. In the case of VM, it is possible to use the Microsoft.Compute provider as usual, and use a Microsoft.ClassicCompute provider as an old model to start up, stop, etc. in one operation. The setting on LogicFlow is as follows.

image

I did a trial and error, because I can not find the document of the setting content・・・

When you select a subscription, you can select the target resource group and you can select the provider you want to use, so we will set up here in order from the top.

Short Resource Id, but this is where the provider specifies possible operations. The operation list for each provider is Docs , but since it may be different from the latest state, it is safe to check with PowerShell etc. just in case.

X - ms - api - version sets the version information of the API to be used. Since this depends on the provider thing, you should check it in advance. When doing with LogicFlow, by using the action Read Resource Provider that obtains the information of the target provider, you can obtain list information of operations that can be executed by that provider, and it also includes API version information.

image

Finally, specify the operation you want to execute with Action name.

・・・it seems very simple to write like this, but in fact the method specified by each provider is slightly different, which makes it very difficult.

For example, it says that VM can be started by calling virtualMachines / start / action using the Microsoft.Compute provider, but in fact it calls action to virtualMachines / {VM name} / start You need to do. And as it is set in the previous screenshot, so that it works,

  • Short Resource Id: virtualMachine / {VM name}
  • Action Name: start

It was very time consuming to notice here first. There is a problem with the display on the designer of the ARM connector now, and when you open the designer again after setting as above, the display will be wrong. Although it goes crazy, since it is actually set correctly, it becomes a magical state.

image

the display of Short Resource Id and Action Name will be incorrect · · ·.

Aside from doing this, you can start the VM, but here is another bug in it.

image

This is a log on the VM side, it is recorded that the startup was started at 23:28:28(JPN)

image

In contrast to this, it is LogicApps' side log, but there is only a history that has failed spectacularly. The error returned from the ARM connector is also 404 Not Found and there is an error saying that the specified resource is missing.

However, as the VM itself has been started, this is the current state that it is a malfunction on the ARM connector side.

Although it is an ARM connector that feels difficult to use yet, there is no doubt that it is a very powerful connector that allows you to operate providers directly, deploy them using templates, and do one thing you can do on Azure.

If you try it in various ways, it may be easier for LogicFlow to do daily management tasks etc.

0 件のコメント:

コメントを投稿