How to get Authorization Token for VMSS resources?

Nitin Singh 21 Reputation points
2022-06-03T16:14:31.977+00:00

Hi All,

I would like to lilst/update the VMSS resources; like scale up or scale down using azure rest API. I found it's possible using following API.

GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmScaleSetName}?api-version=2022-03-01

However, I am not sure how to get the Authorization Token for VMSS resources.

Also, Is there any better way to scale up or scale down the VMs in a real time scenario. I have this use case where I would like to scale up based on the application requirement.

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Sudipta Chakraborty 1,116 Reputation points
    2022-06-03T17:54:10.427+00:00

    @Nitin Singh :

    If you are using Azure CLI (https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli), you can get the Access Token (Bearer Token) using the following commands:

    az login  
    az account set  --subscription "YOUR SUBSCRIPTION ID"  
    az account get-access-token  
    
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.