Skip to content

Instantly share code, notes, and snippets.

@cloudchristoph
Created September 6, 2020 10:40
Show Gist options
  • Save cloudchristoph/865c8cd2130ed4fa3700053d8c95902c to your computer and use it in GitHub Desktop.
Save cloudchristoph/865c8cd2130ed4fa3700053d8c95902c to your computer and use it in GitHub Desktop.
Azure Bicep - Erstes Template
param location string = resourceGroup().location
param environment string = 'dev'
param appName string = 'myapp'
var storageAccountName = 'st${appName}${environment}'
resource MyStorageAccount 'Microsoft.Storage/storageAccounts@2019-06-01' = {
name: storageAccountName
location: location
kind: 'Storage'
sku: {
name: 'Standard_LRS'
}
}
output storageId string = MyStorageAccount.id
output blobEndpoint string = MyStorageAccount.properties.primaryEndpoints.blob
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "string",
"defaultValue": "[resourceGroup().location]"
},
"environment": {
"type": "string",
"defaultValue": "dev"
},
"appName": {
"type": "string",
"defaultValue": "myapp"
}
},
"functions": [],
"variables": {
"storageAccountName": "[format('st{0}{1}', parameters('appName'), parameters('environment'))]"
},
"resources": [
{
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"name": "[variables('storageAccountName')]",
"location": "[parameters('location')]",
"kind": "Storage",
"sku": {
"name": "Standard_LRS"
}
}
],
"outputs": {
"storageId": {
"type": "string",
"value": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]"
},
"blobEndpoint": {
"type": "string",
"value": "[reference(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))).primaryEndpoints.blob]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment