How to Access Azure REST APIs with Node JS.

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 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 http://localhost

azure active directory app registration

azure active directory app registration create

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.

azure active directory app registration details

azure active directory app registration key create

azure active directory app registration key details

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.

azure active directory app subscription permissions

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.

azure active directory subscription id

Now we have all the details that we need to access Azure REST APIs, so let create a node project.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Notify of
Inline Feedbacks
View all comments Protection Status
Would love your thoughts, please comment.x