azure - 从 yaml 管道中的变量组参数化 azureSubscription
问题描述
我将 Yaml 用于 Azure devops 管道。我为此使用了分层样式。
我有一个顶级 yaml: feature.yaml,它具有以下结构:
trigger:
...
pool:
vmImage: ...
variables:
group: ...
stages:
- template: deploy.yaml
parameters:
subName: $(subscription) #This should be taken from Variable group
我有 deploy.yaml 作为:
stages:
- stage: deploy
jobs:
- job: deploy
steps:
- task: AzureKeyVault@1
inputs:
azureSubscription: $(paramaters.subName) #This should be resolved from parameter passed form feature.yaml
KeyVaultName: ...
SecretsFilter: '*'
RunAsPreJob: true
但是,每当我从 Azure DevOps 运行它时,我都会收到此错误:
There was a resource authorization issue: "The pipeline is not valid. Job deploy: Step AzureKeyVault input ConnectedServiceName references service connection $(paramaters.subName) which could not be found. The service connection does not exist or has not been authorized for use. For authorization details, refer to https://aka.ms/yamlauthz."
似乎管道无法从变量组中解析 azureSubscription 名称的值。
有什么建议么?
解决方案
我发现最初解析 YAML 时,它希望变量组在范围内。我需要将我的变量组移动到 YAML 文件的顶部,然后它找到了 azure 订阅变量。不是我所期待的。
推荐阅读
- r - R Shiny:源命令在应用程序上打印 TRUE
- autofac - ACP.NET MVC 应用程序的多租户
- flutter - 为什么 Flutter StatefulWidget 子类需要重写默认构造函数?
- c++ - 在控制台中创建一个消息框函数并将参数(文本)传递给它
- javascript - Firebase v9 Firestore:一一添加2个文档
- android - 撰写中的 ColorTrackText
- c# - 如何在名称文件中搜索包含 C#
- javascript - React Big Calendar - 自定义视图中的自定义道具
- angular - 角度重定向到模块
- php - Doctrine 自定义 MariaDB 平台