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

标签 azure azure-web-app-service azure-storage azure-resource-manager 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 \

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

最佳答案

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 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
    }
  }
}

关于azure - 使用 Bicep 设置 Azure 存储帐户装载路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69145422/

相关文章:

java - Microsoft Azure Cosmos DocumentDB 最佳读取查询性能

azure - 从应用服务安全访问 CosmosDB

c# - 页面在 localhost 上加载,但不在 Azure 网站中加载 - 错误 500

.net - 如何从 CloudBlockBlob.UploadFromFileAsync 获取上传进度?

azure - 访问代理/防火墙后面的 Azure 虚拟机

azure - 为什么 PowerBI 没有向我显示 Azure 表存储中的记录?

sql-server - 将所有数据库从源加载到 ADLG2(azure data Lake gen2)

css - 我的 ASP.Net Core 1.1 元素的 CSS 设置在发布到 Azure 后不会出现。

Azure 存储表权限

Azure Pipeline/AZ 复制未复制到存储 blob 中的根目录