question

NguyenVanLinh-1077 avatar image
0 Votes"
NguyenVanLinh-1077 asked tbgangav-MSFT answered

How to run Azure Powershell by Ansible or Azure CLI?

I am trying to create Runbook in Automation Account so I would like to create by Ansible or Azure CLI which can do it.

I have read some documents that say it is possible to use Azure Powershell. but I don't know of any way to use Azure Powershell through Ansible or Azure CLI or some automatic way. Can someone help me? Thank you.

azure-automation
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tbgangav-MSFT avatar image
1 Vote"
tbgangav-MSFT answered

Hi @NguyenVanLinh-1077,

Currently there is no direct ansible plugin / module supported for creating Azure Automation runbook. I hope you are aware that these are the currently supported plugins / modules under azure.azcollection collection. This is the feature request for the same which has already been raised in Sep'21. Just now I have request for an update on it and also asked for ETA by when plugin to create runbook under azure.azcollection collection will be available to use. I would recommend to follow it for updates.

On the other hand, with the features that are currently available, try to leverage ansible.windows.win_powershell plugin / module of ansible.windows collection in your playbook and leverage New-AzAutomationRunbook Azure PowerShell cmdlet under the script parameter of it.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tbgangav-MSFT avatar image
1 Vote"
tbgangav-MSFT answered

Hi @NguyenVanLinh-1077,

In addition to my previous comment, I wanted to let you know that this is the Azure CLI command and this is the Azure REST API to create Azure Automation Runbook. Sharing in case you want to give a try using Azure CLI or Azure REST API by leverage this / this Ansible embedded command/shell which can be used to call CLI commnands.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

tbgangav-MSFT avatar image
0 Votes"
tbgangav-MSFT answered

Hi @NguyenVanLinh-1077,

I have worked with our internal team and then this feature request is taken care.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.