GilbertCubio-4966 avatar image
0 Votes"
GilbertCubio-4966 asked GilbertCubio-4966 commented

Powershell cmdlet equivalent of az cli commands

Is there a best reference to find the best equivalent ps cmdlet for an az cli command?
I am trying to find an equivalent ps cmdlet for az cli command az acr agentpool .
could not find any equivalent so far. Would highly appreciate if anyone could point me to right direction and I would explore the rest.
am trying to automate agent pool update thru azure runbook.

I appreciate your suggestions.

Thank you.

· 4
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.

Hi @GilbertCubio-4966,

Firstly, I don't think there is a direct way to find the best equivalent az ps cmdlet for an az cli command. The best way to find best equivalent ps cmdlet for an az cli command is by checking particular azure service's official documentation reference section i.e., for example check the below highlighted "Azure CLI" and "PowerShell" sections in the illustrated az acr official documentation.


Secondly, even I couldn't find equivalent az ps cmdlets or az rest api commands for az acr agentpool cli commands. The reason for checking rest api commands as well is if we at least had equivalent rest api commands then I would have recommended to invoke rest api command from the runbook using Invoke-RestMethod ps cmdlet.

So finally, the recommended workaround would be to go with hybrid runbook worker and install az cli in a machine, configure that machine as a hybrid worker and use that hybrid worker to execute the runbook.

For more information with regards to it, please check below articles.

0 Votes 0 ·
image.png (78.5 KiB)

I already tried creating the hybrid worker runbook yesterday. AZ cli installed. Used system assigned managed identity for the worker vm. Tried az login --identity inside the vm and I can login fine. However, it fails when running from the runbook. Upon checking, the runbook creates a sandbox inside the VM and seems it doesn't inherit the VM identity.



0 Votes 0 ·
image.png (27.4 KiB)
image.png (4.8 KiB)
tbgangav-MSFT avatar image tbgangav-MSFT GilbertCubio-4966 ·

Hi @GilbertCubio-4966,

It looks like a permission issue. Check this Azure document to configure managed identities (using managed identity thats used in Automation level) for Azure resources on a VM using the Azure portal and validate if its configured as expected.

0 Votes 0 ·
Show more comments

0 Answers