简体   繁体   English

在VSTS版本定义中的Azure CLI中使用服务主体

[英]Use Service Principal in Azure CLI in VSTS Release Definition

We have a Resource Manager service principal configured through VSTS settings to access an Azure subscription. 我们具有通过VSTS设置配置的资源管理器服务主体,以访问Azure订阅。 Everything works wonderfully when we use the Powershell Resource Manager built in tasks. 当我们使用内置任务的Powershell资源管理器时,一切工作都很棒。 However, we have a build agent that is running on a Mac because it needs to build a Xamarin project. 但是,我们有一个在Mac上运行的生成代理,因为它需要生成Xamarin项目。

After Xamarin builds the .ipa we need to upload it to blob storage. Xamarin构建.ipa之后,我们需要将其上传到Blob存储。 We would like to grab the storage access token from Azure using the service principal on every release instead of storing the token ourselves, but we don't have access to Powershell because we're running on a Mac. 我们想在每个发行版上使用服务主体从Azure获取存储访问令牌,而不是自己存储令牌,但是我们无法访问Powershell,因为我们在Mac上运行。 We can use the Azure CLI, but we need to access the same service principal information that the built in Powershell Azure RM tasks use. 我们可以使用Azure CLI,但是我们需要访问与Powershell Azure RM内置任务相同的服务主体信息。

Any ideas? 有任何想法吗?

You can separate the build and upload action into build and release. 您可以将构建和上传操作分为构建和发布。 In the build definition, run the Xamarin build and publish the .ipa file to artifacts with Mac agents, and then in the release definition, upload the artifacts to Azure Blob with Windows agent. 在内部版本定义中,运行Xamarin内部版本并将.ipa文件发布到具有Mac代理的工件,然后在发行版本定义中,将该工件上传到具有Windows代理的Azure Blob。

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

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