In this post, I will show you can access the Azure REST APIs. In order to access the Azure APIs, we need following details- tenant ID, client ID(application ID), client secret and subscription ID.
So let's grab all the above-mentioned details from your Azure portal. Lets login to the Azure portal by visiting
How to get tenant ID (Directory ID)
After login click on the Azure Active Directory and then click on Properties, then grab the tenant ID (Directory ID).
How to get client ID(application ID) / client secret
Now Click on App Registrations and create a new application, I am naming my application
node-test-app and its type is
Web app/API and Sign-on URL can be anything, so I gave
click on the app you just created and grab the client ID (application ID) and then click on the settings link and then from the right menu panel select keys to generate client secret. While generating client secret select never expiry option.
Grant access to your subscriptions
Now give access to Azure active directory application to access your subscription. Go to your subscription by click on all services and select your subscription and click on access control and click on add. And the role is going to be the contributor and we want to search for your app we called it
node-test-app click select and then click ok.
Now your application has access to your subscription so when we make rest API calls it can be done on behalf of your application instead of a user.
How to get subscription ID
One final thing that we need is subscription ID, so lets again click on all services and click on subscription and then copy the subscription ID.
Now we have all the details that we need to access Azure REST APIs, so let create a node project.