【发布时间】:2020-12-08 16:37:10
【问题描述】:
我正在寻找一个或多个 CreateOrUpDate 列出 AAD 对象的示例。 我可能也会将此安排为夜间工作。 我希望将此添加到我的 YAML Azure 管道文件中的任务中。
我对 CreateOrUpdate 完全陌生,因此非常感谢您提供任何帮助。
【问题讨论】:
标签: json azure yaml azure-pipelines
我正在寻找一个或多个 CreateOrUpDate 列出 AAD 对象的示例。 我可能也会将此安排为夜间工作。 我希望将此添加到我的 YAML Azure 管道文件中的任务中。
我对 CreateOrUpdate 完全陌生,因此非常感谢您提供任何帮助。
【问题讨论】:
标签: json azure yaml azure-pipelines
您可以查看Azure cli commands 以创建或更新 AAD 对象。文档中有很多例子:
例如,使用命令az ad app create 创建 AAD 应用程序:
az ad app create --display-name my-native --native-app --required-resource-accesses @manifest.json
使用命令az ad user create创建AAD用户:
az ad user create –display-name psmith –password password –user-principal-name username@domain.onmicrosoft.com
使用命令az ad sp create-for-rbac -n "MyApp"创建服务主体
要在 Yaml azure 管道中使用上述 azure cli 命令,您需要使用Azure CLI Task。您需要创建一个Azure Resource Manager service connection 以将您的 azure devops 项目连接到您的 Azure 订阅。请参阅步骤here 创建服务连接。
- task: AzureCLI@2
displayName: Azure CLI
inputs:
azureSubscription: <Name of the Azure Resource Manager service connection>
scriptType: ps
scriptLocation: inlineScript
inlineScript: |
az --version
az account show
如果您熟悉 powershell 脚本,还可以查看 azure powershell commands,它可以在 Azure Powershell Task 中使用来创建或更新 AAD 对象。
【讨论】: