Coder Perfect

Bicep allows you to set the mount path for your Azure Storage Account.


I had the following Storage Account configuration before using the Azure CLI script:

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 \

Now I’m trying to write this in Bicep, but I can’t seem to find any mount-path config. Is it possible to include this in a Bicep file?

Asked by Sergiu Molnar

Solution #1

Because the Web Apps – Update Azure Storage Accounts accepts a dictionary of storage properties, something along these lines should work:

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
      accessKey: listKeys(, storageAccount.apiVersion).keys[0].value

Answered by Thomas

Post is based on