使用 Bicep 设置 Azure 存储帐户装载路径

Ser*_*nar 2 azure azure-storage azure-resource-manager azure-web-app-service azure-bicep

以前,使用 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 \
Run Code Online (Sandbox Code Playgroud)

现在,我尝试用 Bicep 编写此内容,但我找不到mount-path. 是否有可能在 Bicep 文件中设置它?

Tho*_*mas 6

Web应用程序 - 更新 Azure 存储帐户接受存储属性的字典,因此类似的内容应该可以工作:

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 webApp 'Microsoft.Web/sites@2021-01-15' existing = {
  name: webAppName
}
resource storageSetting 'Microsoft.Web/sites/config@2021-01-15' = {
  name: 'azurestorageaccounts'
  parent: webApp
  properties: {
    '${shareName}': {
      type: 'AzureFiles'
      shareName: shareName
      mountPath: mountPath
      accountName: storageAccount.name
      accessKey: storageAccount.listKeys().keys[0].value
    }
  }
}
Run Code Online (Sandbox Code Playgroud)