azure - Gitlab CI 无法从项目设置中选择变量

标签 azure gitlab-ci

我正在使用以下 yaml 文件,其中声明了项目设置中的所有变量。 AZ登录命令运行失败。当我将变量替换为实际值时,它就能够运行了。知道为什么没有从项目设置中选取变量值吗?

variables:
  DEFAULT_RG:
    description: "Default resource group to deploy the resources for testing"
    value: "newgrp"
  DEFAULT_LOCATION:
    description: "Default location of the testing resource group"
    value: "East US"
  
default:
  image: mcr.microsoft.com/azure-cli
  before_script:
    - az login --service-principal --username $SP_ID --password $SP_SECRET --tenant $TENANT_ID
    - az account set --subscription $SUBSCRIPTION_ID
    - set -euo pipefail

stages:
  - deploy
deploy automation account and tie it with UAMI:
  stage: deploy
   
  script:
    - New-AzAutomationAccount -Location $Location -Name $automationccount -ResourceGroupName $ResourceGroup
    - Set-AzAutomationAccount -ResourceGroupName $ResourceGroup -Name $automationccount -AssignUserIdentity "/subscriptions/$SUBSCRIPTION_ID/resourcegroups/$resourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/$userAssignedOne"

最佳答案

嗯,我解决了这个问题。我已将所有变量用作“ protected ”,这意味着我只能在 protected 分支上使用这些变量!

关于azure - Gitlab CI 无法从项目设置中选择变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72262714/

相关文章:

azure - 映射到错误的 LUIS 意图

python - 在 Python 中将资源 ID 从 ADAL 转换为 MSAL

java - Sonarqube 集成到 gitlab.com 上的私有(private)仓库

docker - gitlab-ci docker-in-docker 访问不安全的注册表

azure - 使用 Azure AD 验证计算机

c# - 如何使用 ServiceBus EventData 偏移值

azure - 应用洞察 - 可以在生产中继续运行吗?

continuous-integration - 如何从 GitLab CI 管道的工作发送电子邮件?

mysql - 扩展 mysql docker 镜像时出现 ENOTFOUND

GitLab CI - 当文件内容更改时运行管道