简体   繁体   English

使用Azure App Service中的Powershell命令连接到Azure AD

[英]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. 我在azure应用程序服务中运行Web应用程序,我需要在该服务中获取经过身份验证的用户(通过Azure AD)密码到期详细信息。

How to get password policy for Azure Active Directory logged in user 如何获取Azure Active Directory登录用户的密码策略

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. 但是,现在此代码已部署在Azure App Service上并引发。 "Connect-MsolService" is not defined cmdlet... 未定义“ Connect-MsolService” cmdlet ...

When I got this error on local, it was because Azure AD Powershell module requires to be run on 64 bit environment. 当我在本地遇到此错误时,是因为Azure AD Powershell模块需要在64位环境上运行。 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. 因此,我在Visual Studio工具->选项->项目和解决方案-> Web项目->使用64位版本的IIS Express中选中了以下复选框。就这样,它可以在本地运行。

As it needs 64 bit. 由于它需要64位。 I have also checked Azure Web App->Application Settings->Platform to 64bit (Default is 32 bit) 我还检查了Azure Web App->应用程序设置->平台到64位(默认为32位)

Still the same error of "Unknown cmdlet" 仍然是“未知cmdlet”的相同错误

Anyone experienced this before. 任何人都曾经经历过。

The Azure App Service doesn't install the corresponding PowerShell command-lets. Azure应用服务不会安装相应的PowerShell命令集。 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. 如果要将服务部署到Azure,则需要选择“云服务”或“虚拟机”以启用在Azure环境上安装所需的PowerShell。

More detail about the difference, you can refer below link: 有关差异的更多详细信息,您可以参考以下链接:

Should I choose cloud services or something else? 我应该选择云服务还是其他?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM