Mandar Jogalekar
Mandar Jogalekar

Reputation: 3281

Connect to Azure AD using Powershell commands from Azure App Service

I run web app in azure app service, where I need to get Authenticated Users(via Azure AD) Password Expiry Details.

How to get password policy for Azure Active Directory logged in user

I follow above answer and I got it working on Local visual studio.

However Now this code is deployed on Azure App Service and it throws. "Connect-MsolService" is not defined cmdlet...

When I got this error on local, it was because Azure AD Powershell module requires to be run on 64 bit environment. So I checked following checkbox in Visual Studio Tools->Options->Projects & Solutions->Web Projects->Use 64 bit version of IIS Express.. That was it and it worked on local.

As it needs 64 bit. I have also checked Azure Web App->Application Settings->Platform to 64bit (Default is 32 bit)

Still the same error of "Unknown cmdlet"

Anyone experienced this before.

Upvotes: 1

Views: 928

Answers (1)

Fei Xue
Fei Xue

Reputation: 14649

The Azure App Service doesn't install the corresponding PowerShell command-lets. If you want to deploy the service to Azure, you need to choose Cloud Service or Virtual Machine to enable install the required PowerShell on the Azure environment.

More detail about the difference, you can refer below link:

Should I choose cloud services or something else?

Upvotes: 2

Related Questions