Last active
October 1, 2021 15:42
-
-
Save dazfuller/0740f1640225dc8ea0eb29a8e6f88a6a to your computer and use it in GitHub Desktop.
Azure Data Lake Gen 2 - ARM template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "0.0.0.1", | |
"parameters": { | |
"resourcePrefix": { | |
"type": "string", | |
"minLength": 3, | |
"maxLength": 10, | |
"metadata": { | |
"description": "The prefix to use for resources within the resource group" | |
} | |
}, | |
"storageSku": { | |
"type": "string", | |
"defaultValue": "Standard_LRS", | |
"allowedValues": [ | |
"Standard_LRS", | |
"Standard_ZRS", | |
"Standard_GRS", | |
"Standard_RAGRS" | |
], | |
"metadata": { | |
"description": "Defines the type of storage account to use for the data lake store" | |
} | |
} | |
}, | |
"variables": { | |
"storageAccountApiVersion": "[utils.apiVersion('Microsoft.Storage', 'storageAccounts')]", | |
"storageAccountName": "[utils.uniqueName(parameters('resourcePrefix'), 'store')]", | |
"storageAccountResourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]" | |
}, | |
"functions": [ | |
{ | |
"namespace": "utils", | |
"members": { | |
"apiVersion": { | |
"parameters": [ | |
{ | |
"name": "providerNamespace", | |
"type": "string" | |
}, | |
{ | |
"name": "resourceType", | |
"type": "string" | |
} | |
], | |
"output": { | |
"type": "string", | |
"value": "[providers(parameters('providerNamespace'), parameters('resourceType')).apiVersions[0]]" | |
} | |
}, | |
"uniqueName": { | |
"parameters": [ | |
{ | |
"name": "resourcePrefix", | |
"type": "string" | |
}, | |
{ | |
"name": "resourceSuffix", | |
"type": "string" | |
} | |
], | |
"output": { | |
"type": "string", | |
"value": "[concat(parameters('resourcePrefix'), uniqueString(resourceGroup().id), parameters('resourceSuffix'))]" | |
} | |
} | |
} | |
} | |
], | |
"resources": [ | |
{ | |
"type": "Microsoft.Storage/storageAccounts", | |
"apiVersion": "[variables('storageAccountApiVersion')]", | |
"location": "[resourceGroup().location]", | |
"name": "[variables('storageAccountName')]", | |
"kind": "StorageV2", | |
"sku": { | |
"name": "[parameters('storageSku')]" | |
}, | |
"properties": { | |
"encryption": { | |
"keySource": "Microsoft.Storage", | |
"services": { | |
"blob": { | |
"enabled": true | |
}, | |
"file": { | |
"enabled": true | |
} | |
} | |
}, | |
"isHnsEnabled": true, | |
"supportsHttpsTrafficOnly": true | |
} | |
} | |
], | |
"outputs": { | |
"storageAccountName": { | |
"type": "string", | |
"value": "[variables('storageAccountName')]" | |
}, | |
"storageAccountConnectionString": { | |
"type": "string", | |
"value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storageAccountName'), ';AccountKey=', listKeys(variables('storageAccountResourceId'), variables('storageAccountApiVersion')).keys[0].value)]" | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param ( | |
[Parameter(Mandatory=$true)] [string] $ResourceGroupName, | |
[Parameter(Mandatory=$true)] [string] [ValidateSet("northeurope", "westeurope")] $Location, | |
[Parameter(Mandatory=$true)] [string] $ResourcePrefix | |
) | |
$ResourceGroup = Get-AzureRmResourceGroup -Name $ResourceGroupName -ErrorAction SilentlyContinue | |
if ($null -eq $ResourceGroup) { | |
$ResourceGroup = New-AzureRmResourceGroup -Name $ResourceGroupName -Location $Location | |
} | |
$Parameters = @{} | |
$Parameters["resourcePrefix"] = $ResourcePrefix | |
$Parameters["storageSku"] = "Standard_LRS" | |
$Deployment = New-AzureRmResourceGroupDeployment -Name ($ResourceGroupName + '-deployment-' + ((Get-Date).ToUniversalTime()).ToString('MMdd-HHmm')) ` | |
-ResourceGroupName $ResourceGroupName ` | |
-TemplateFile "$($PSScriptRoot)/azuredeploy.json" ` | |
-TemplateParameterObject $Parameters ` | |
-Force ` | |
-Verbose | |
Write-Host "Storage Account" | |
Write-Host "Account Name : $($Deployment.Outputs["storageAccountName"].Value)" | |
Write-Host "Connection String : $($Deployment.Outputs["storageAccountConnectionString"].Value)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Template can be deployed as follows: