Interactive Logon Required for Azure Resources NodeJS App

78 Views Asked by At

I am looking to pull a list of Azure resources such as VMs, AppServices, etc and possibly interact (create, delete, scale, etc.) via the Azure SDK for NodeJS. The examples seem to demonstrate/push the use of an interactive login.

The reason I don't want to use the interactive logon is so I can schedule these tasks instead of requiring interaction.

Example, I looked at the authentication module and it is focused on interactive logon as well. Is there another means to authenticate instead of interactive as the previous SDK seemed to allow to authentication via secrets and subscription ID:

//Environment Setup
_validateEnvironmentVariables();
var clientId = process.env['CLIENT_ID'];
var domain = process.env['DOMAIN'];
var secret = process.env['APPLICATION_SECRET'];
var subscriptionId = process.env['AZURE_SUBSCRIPTION_ID'];
var credentials = new msRestAzure.ApplicationTokenCredentials(clientId, domain, secret, { 'tokenCache': tokenCache });
1

There are 1 best solutions below

0
On

After assistance with the SDK team, there are options for auth for node, but better to get these from the node site and use the @azure ones as those are the most up to date. Ex: https://www.npmjs.com/package/@azure/ms-rest-nodeauth