【问题标题】:Can we refer a storage account properties in second bicep file?我们可以在第二个二头肌文件中引用存储帐户属性吗?
【发布时间】:2021-10-19 17:34:56
【问题描述】:

我有 2 个 azure bicep 文件。

  1. Storage.二头肌
  2. cdn.二头肌

现在,我从 storage.bicep 成功创建了一个存储帐户和 BLOB 容器。是否可以从 storage.bicep 中获取存储帐户属性的值以在 cdn.bicep 中使用它?

【问题讨论】:

  • 请提供足够的代码,以便其他人更好地理解或重现问题。

标签: azure azure-devops azure-bicep


【解决方案1】:

是的,如果您将存储帐户名称传递给它,您可以将cdn.bicep 中的存储帐户作为现有资源引用。

resource stg 'Microsoft.Storage/storageAccounts@2019-06-01' existing = {
  name: 'examplestorage'
}

output blobEndpoint string = stg.properties.primaryEndpoints.blob

只要确保你声明 cdn.bicep 依赖于 Storage.bicep 并在它之后执行。

上面的例子取自documentation

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-13
    • 2021-07-30
    • 1970-01-01
    • 2022-10-13
    • 1970-01-01
    • 2021-10-26
    相关资源
    最近更新 更多