简体   繁体   中英

azure API to restart VM

When I try to list azure VMs on my account from their python API, I get the following error: Message: The client 'xxxxxxxxxxxxxxxxxxx' with object id 'xxxxxxxxxxxxxxxxx' does not have authorization to perform action 'Microsoft.Compute/virtualMachines/read' over scope '/subscriptions/xxxxxxxxxxxx/resourceGroups/xxxxxxxxx/providers/Microsoft.Compute/virtualMachines/xxxxxx'.

Does this type of API access require paid access or did I set up my authentication incorrectly?

You authentication is correct, but you just need proper permissions on the Azure side. So you need to grant yourself (the client you are acting from) a Virtual Machine Contributor or Contributor role to the resource group the VM is in (or to the subscription).

Take a look at this link .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM