azure-resources/workplace-cloud-storage/storageAccount.json
|
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "metadata": { "_generator": { "name": "bicep", "version": "0.47.16.16243", "templateHash": "6034044203842702939" } }, "parameters": { "storageAccountName": { "type": "string", "minLength": 3, "maxLength": 24, "metadata": { "description": "The name of the Workplace Cloud Storage account (3-24 lowercase letters and digits, globally unique)" } }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", "metadata": { "description": "Azure region of a newly created storage account" } }, "skuName": { "type": "string", "defaultValue": "Standard_LRS", "allowedValues": [ "Standard_LRS", "Standard_ZRS", "Standard_GRS", "Standard_RAGRS", "Standard_GZRS", "Standard_RAGZRS" ], "metadata": { "description": "The SKU of a newly created storage account" } }, "deployStorageAccount": { "type": "bool", "defaultValue": true, "metadata": { "description": "Whether to create the storage account (set to false to only assign the role on an existing account)" } }, "servicePrincipalId": { "type": "string", "metadata": { "description": "The object ID of the RealmJoin service principal" } }, "assignBlobDataContributorRole": { "type": "bool", "defaultValue": true, "metadata": { "description": "Whether to assign the Storage Blob Data Contributor role (set to false if role is already assigned)" } }, "storageBlobDataContributorRoleId": { "type": "string", "metadata": { "description": "The Storage Blob Data Contributor role definition ID" } } }, "resources": [ { "condition": "[parameters('deployStorageAccount')]", "type": "Microsoft.Storage/storageAccounts", "apiVersion": "2026-09-01", "name": "[parameters('storageAccountName')]", "location": "[parameters('location')]", "kind": "StorageV2", "sku": { "name": "[parameters('skuName')]" }, "properties": { "allowBlobPublicAccess": true, "allowSharedKeyAccess": false } }, { "condition": "[parameters('assignBlobDataContributorRole')]", "type": "Microsoft.Authorization/roleAssignments", "apiVersion": "2022-04-01", "scope": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]", "name": "[guid(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), parameters('servicePrincipalId'), parameters('storageBlobDataContributorRoleId'))]", "properties": { "principalId": "[parameters('servicePrincipalId')]", "principalType": "ServicePrincipal", "roleDefinitionId": "[subscriptionResourceId('Microsoft.Authorization/roleDefinitions', parameters('storageBlobDataContributorRoleId'))]" }, "dependsOn": [ "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" ] } ], "outputs": { "storageAccountId": { "type": "string", "metadata": { "description": "The resource ID of the Storage Account" }, "value": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" }, "storageAccountName": { "type": "string", "metadata": { "description": "The name of the Storage Account" }, "value": "[parameters('storageAccountName')]" }, "blobEndpoint": { "type": "string", "metadata": { "description": "The primary blob endpoint of the Storage Account" }, "value": "[reference(resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName')), '2026-09-01').primaryEndpoints.blob]" } } } |