Skip to content

Commit

Permalink
Fix name for storage account due to availability
Browse files Browse the repository at this point in the history
  • Loading branch information
mburumaxwell committed Sep 25, 2023
1 parent 10bef48 commit ef26f7a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion server/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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' }
Expand Down
13 changes: 7 additions & 6 deletions server/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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'))]"
]
},
{
Expand All @@ -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'))]"
]
},
{
Expand Down Expand Up @@ -171,7 +172,7 @@
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2022-09-01",
"name": "[parameters('name')]",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"kind": "StorageV2",
"sku": {
Expand Down

0 comments on commit ef26f7a

Please sign in to comment.