From ef26f7aaf5bc2269000c0b0d5707edc497a4d67b Mon Sep 17 00:00:00 2001 From: Maxwell Weru Date: Mon, 25 Sep 2023 08:43:25 +0300 Subject: [PATCH] Fix name for storage account due to availability --- server/main.bicep | 3 ++- server/main.json | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/server/main.bicep b/server/main.bicep index 4b16f2d7..d9da7986 100644 --- a/server/main.bicep +++ b/server/main.bicep @@ -22,6 +22,7 @@ var fileShares = [ { name: 'working-dir', writeable: true } ] +var storageAccountName = name == 'dependabot' ? 'dependabotstore' : name // dependabot is not available as of 2023-Sep-25 so we change just for the public deployment var sqlServerAdministratorLogin = uniqueString(resourceGroup().id) // e.g. zecnx476et7xm (13 characters) var sqlServerAdministratorLoginPassword = '${skip(uniqueString(resourceGroup().id), 5)}%${uniqueString('sql-password', resourceGroup().id)}' // e.g. abcde%zecnx476et7xm (19 characters) var queueNames = [ @@ -78,7 +79,7 @@ resource appConfiguration 'Microsoft.AppConfiguration/configurationStores@2023-0 /* Storage Account */ resource storageAccount 'Microsoft.Storage/storageAccounts@2022-09-01' = { - name: name + name: storageAccountName location: location kind: 'StorageV2' sku: { name: 'Standard_LRS' } diff --git a/server/main.json b/server/main.json index 21a693bf..9048c855 100644 --- a/server/main.json +++ b/server/main.json @@ -78,6 +78,7 @@ "writeable": true } ], + "storageAccountName": "[if(equals(parameters('name'), 'dependabot'), 'dependabotstore', parameters('name'))]", "sqlServerAdministratorLogin": "[uniqueString(resourceGroup().id)]", "sqlServerAdministratorLoginPassword": "[format('{0}%{1}', skip(uniqueString(resourceGroup().id), 5), uniqueString('sql-password', resourceGroup().id))]", "queueNames": [ @@ -98,13 +99,13 @@ }, "type": "Microsoft.Storage/storageAccounts/fileServices/shares", "apiVersion": "2022-09-01", - "name": "[format('{0}/{1}/{2}', parameters('name'), 'default', variables('fileShares')[copyIndex()].name)]", + "name": "[format('{0}/{1}/{2}', variables('storageAccountName'), 'default', variables('fileShares')[copyIndex()].name)]", "properties": { "accessTier": "[if(contains(variables('fileShares')[copyIndex()], 'accessTier'), variables('fileShares')[copyIndex()].accessTier, 'TransactionOptimized')]", "shareQuota": "[if(contains(variables('fileShares')[copyIndex()], 'shareQuota'), variables('fileShares')[copyIndex()].shareQuota, 1)]" }, "dependsOn": [ - "[resourceId('Microsoft.Storage/storageAccounts', parameters('name'))]" + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ] }, { @@ -117,15 +118,15 @@ "name": "[format('{0}/{1}', parameters('name'), variables('fileShares')[copyIndex()].name)]", "properties": { "azureFile": { - "accountName": "[parameters('name')]", - "accountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', parameters('name')), '2022-09-01').keys[0].value]", + "accountName": "[variables('storageAccountName')]", + "accountKey": "[listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2022-09-01').keys[0].value]", "shareName": "[variables('fileShares')[copyIndex()].name]", "accessMode": "[if(and(contains(variables('fileShares')[copyIndex()], 'writeable'), bool(variables('fileShares')[copyIndex()].writeable)), 'ReadWrite', 'ReadOnly')]" } }, "dependsOn": [ "[resourceId('Microsoft.App/managedEnvironments', parameters('name'))]", - "[resourceId('Microsoft.Storage/storageAccounts', parameters('name'))]" + "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" ] }, { @@ -171,7 +172,7 @@ { "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2022-09-01", - "name": "[parameters('name')]", + "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", "kind": "StorageV2", "sku": {