Azure : Silent Authentication using Azure AD application

Use Case 

You want to automate management operations on Azure resources using Azure Powershell. For this, you need a way to silently authentication (Without any login prompt).

You can achieve this by creating an Azure AD application which will give Service Principal Id, which can be used for authentication


Get Service Principle Id for silent authentication 

Please run below Power-Shell script to create a native AD application from which we will get service principal ID that will be used to do silent authentication. This is a one time job.

NoteYou need to be Global admin on active directory to create the native AD appliction.

When you run this script, you will get prompt to provide Subscription Name, Password and then log in.

After completion, you will get below information in output:


NotePlease keep a note of th.s information, we'll use it in following steps.


Login using Service Principal Id without user interaction 

  • Create a PowerShell and save as run.ps1
  • Update Service Principal Id, Tenant Id, Subscription Id and Password values using output of previous step.

NoteIn above sample, We have shown how to STOP/START an Azure App Service without any user interaction.

After login, you can run any PowerShell script which requires subscription level access without any user interaction.


Comments (0)

Skip to main content