我们有一个多阶段 YAML 管道,可以对现有的一组 Azure 资源执行 CI/CD
阶段是
- 建造
- 部署到开发和运行测试
- 如果 Previous 成功 - 部署到生产环境并运行测试
我们AzureRmWebAppDeployment
在部署阶段使用该任务,并使用该任务的 AppSettings 参数来指定特定于环境的设置。例如
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(azureSubscriptionEndpoint)'
appType: '$(webAppKind)'
WebAppName: 'EXISTING__AZURE_RESOURCENAME-DEV'
Package: '$(Pipeline.Workspace)/**/*.zip'
AppSettings: >
-AzureAd:CallbackPath /signin-oidc
-AzureAd:ClientId [GUID was here]
-AzureAd:Domain [domain was here]
-AzureAd:Instance https://login.microsoftonline.com/
-AzureAd:TenantId [Id was here]
-EmailServer:SMTPPassword SECRETPASSWORD
-EmailServer:SMTPUsername SECRETUSERNAME
该集中有两个设置EmailServer: SMTPUsername
,EmailServer: SMTPPassword
我想从 Azure KeyVault 中提取它们。我知道如何使用语法从 Azure 门户引用 KV 机密
@Microsoft.KeyVault(SecretUri=https://our.vault.azure.net/secrets/SendGridPassword/ReferenceGuidHere)
但是如何引用 YAML 管道中的值以便在 Azure 中设置它?