在发布管道中,我尝试使用Connect-Azaccount连接到Azure AD,以便我可以运行Get-AzADgroup来检索某些Az AD组名称及其guid并将其输出到变量。
我使用以下嵌入式脚本创建了Azure Powershell任务。
(Get-AzADGroup -DisplayName“ group-name”)。起源
答案 0 :(得分:0)
似乎您需要使用非交互式登录,请按照以下步骤操作。
1。Create an Azure Active Directory application和create a secret,保存该机密和get values for signing in。
2。在AD应用程序中-> API permissions
-> Add a permission
->选择Azure Active Directory Graph
-> Application permissions
-> Directory.Read.All
->单击{{ 1}}->单击 Add permissions
,请参阅屏幕截图。
3。尝试以下脚本,使用在步骤1中获得的值,对我而言效果很好。
注意:使用Grant admin consent for xxx
powershell模块时,需要将Task version
与4.*(preview)
一起使用。
Az