【问题标题】:Set Azure Storage Account mount path with Bicep使用 Bicep 设置 Azure 存储帐户装载路径
【发布时间】:2021-11-07 17:27:40
【问题描述】:

以前,使用 Azure CLI 脚本,我有以下存储帐户配置:

az webapp config storage-account add \
  --resource-group $resourceGroup \
  --name $functionAppName \
  --storage-type AzureFiles \
  --share-name $shareName \
  --custom-id $shareId \
  --account-name $AZURE_STORAGE_ACCOUNT \
  --mount-path $mountPath \

现在,我正在尝试使用 Bicep 编写此内容,但我找不到 mount-path 的任何配置。有没有可能在二头肌文件中设置它?

【问题讨论】:

    标签: azure azure-web-app-service azure-storage azure-resource-manager azure-bicep


    【解决方案1】:

    Web Apps - Update Azure Storage Accounts 接受存储属性的字典,所以这样的东西应该可以工作:

    var webAppName = 'web app name'
    var storageAccountName = 'storage account name'
    var shareName = 'share name'
    var mountPath = 'mount path'
    
    resource storageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' existing = {
      name: storageAccountName
    }
    
    resource storageSetting 'Microsoft.Web/sites/config@2021-01-15' = {
      name: '${webAppName}/azurestorageaccounts'
      properties: {
        '${shareName}': {
          type: 'AzureFiles'
          shareName: shareName
          mountPath: mountPath
          accountName: storageAccount.name      
          accessKey: listKeys(storageAccount.id, storageAccount.apiVersion).keys[0].value
        }
      }
    }
    
    

    【讨论】:

    • 非常感谢。有效。但我还是无法理解。为什么我必须将所有这些道具分组到properties > shareName 下?
    • 您可以传递一个共享列表,它会为每个共享提供唯一的名称。是的,我知道这有点奇怪......
    猜你喜欢
    • 2017-06-28
    • 1970-01-01
    • 2021-08-21
    • 1970-01-01
    • 2020-05-19
    • 2015-12-14
    • 2018-01-29
    • 2023-02-15
    • 1970-01-01
    相关资源
    最近更新 更多