Azure 组变量未选择我的 appsetting.json 文件变量

标签 azure azure-devops continuous-integration azure-pipelines devops

我正在研究 Azure DevOps,并使用 Azure CD 管道将我的 Web 应用程序部署到 Azure Web 应用程序服务中,我正在使用 Azure 组变量将我的应用程序设置值替换为组变量中提到的我定义的值。

下面是我的 appsetting.json 文件

"ConnectionStrings": { "AllegationDBConnectionString": "Server=sqlserver;Database=database;User ID=username; pwd =password;" },

我的组变量是 Image .

我尝试添加:

  1. AllegationDBConnectionString
  2. ConnectionStrings:AllegationDBConnectionString
  3. 连接字符串

在组变量的名称部分,但不起作用。
如何替换 Azure 组变量中 AllegationDBConnectionString 的值

最佳答案

因此,如果 ConnectionStrings 是 json 的顶级元素 - 您的变量名称必须是:

ConnectionStrings.AllegationDBConnectionString

https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/transforms-variable-substitution?view=azure-devops#json-variable-substitution-example

关于Azure 组变量未选择我的 appsetting.json 文件变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60167985/

相关文章:

entity-framework - 具有分支依赖项的分支项目的 TFS 策略

ubuntu - 无法在 Ubuntu 上启动 Jenkins 服务

rest - 使用 REST API 获取 TFS 工作项及其链接

azure - 是否可以允许 Azure 弹性作业访问 Azure SQL 数据库,而不需要允许所有 Azure 资源访问服务器?

java - wget azure REST API 时授权失败

Azure应用程序注册客户端 secret 过期

c# - 从 WIndows 窗体连接到 Visual Studio Team Services 时发生未经授权的异常

Azure DevOps CI 构建器拉取访问被拒绝,存储库不存在或可能需要 'docker login'

continuous-integration - 如何在 GitHub Actions 上将 PNPM 工作区项目作为并行作业运行?

Azure 表存储快照/备份功能