如何在Azure DevOps发布管道中建立连接帐户

时间:2019-05-28 22:44:03

标签: azure azure-devops azure-powershell

enter image description here

在发布管道中,我尝试使用Connect-Azaccount连接到Azure AD,以便我可以运行Get-AzADgroup来检索某些Az AD组名称及其guid并将其输出到变量。

我使用以下嵌入式脚本创建了Azure Powershell任务。

(Get-AzADGroup -DisplayName“ group-name”)。起源

enter image description here

1 个答案:

答案 0 :(得分:0)

似乎您需要使用非交互式登录,请按照以下步骤操作。

1。Create an Azure Active Directory applicationcreate 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 ,请参阅屏幕截图。

enter image description here

enter image description here

3。尝试以下脚本,使用在步骤1中获得的值,对我而言效果很好。

注意:使用Grant admin consent for xxx powershell模块时,需要将Task version4.*(preview)一起使用。

Az

enter image description here

相关问题