Skip to content

Instantly share code, notes, and snippets.

@backerman
Created August 9, 2020 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save backerman/a6e38acdb0e52691cf3e1bd913e462e1 to your computer and use it in GitHub Desktop.
Save backerman/a6e38acdb0e52691cf3e1bd913e462e1 to your computer and use it in GitHub Desktop.
Sample ARM template to deploy a custom FreeBSD image generated from the Marketplace image
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"subnetName": {
"value": null
},
"virtualNetworkName": {
"value": null
},
"virtualMachineName": {
"value": null
},
"virtualMachineSize": {
"value": "Standard_B2s"
},
"adminUsername": {
"value": "azure-user"
},
"adminPublicKey": {
"value": null
},
"imageId": {
"value": null
}
}
}
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"location": {
"type": "String",
"defaultValue": "[resourceGroup().location]"
},
"networkInterfaceName": {
"type": "String",
"defaultValue": "[concat(parameters('virtualMachineName'), uniqueString(resourceGroup().id))]"
},
"subnetName": {
"type": "String"
},
"virtualNetworkName": {
"type": "String"
},
"virtualMachineName": {
"type": "String"
},
"osDiskType": {
"type": "String",
"defaultValue": "Premium_LRS"
},
"virtualMachineSize": {
"type": "String"
},
"adminUsername": {
"type": "String"
},
"adminPublicKey": {
"type": "SecureString"
},
"diagnosticsStorageAccountName": {
"type": "String",
"defaultValue": "[concat('bootdiag', uniqueString(resourceGroup().id))]"
},
"imageId": {
"type": "string"
}
},
"variables": {
"vnetId": "[resourceId('Microsoft.Compute/virtualNetworks', parameters('virtualNetworkName'))]",
"subnetRef": "[concat(variables('vnetId'), '/subnets/', parameters('subnetName'))]"
},
"resources": [
{
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2019-07-01",
"name": "[parameters('networkInterfaceName')]",
"location": "[parameters('location')]",
"dependsOn": [],
"properties": {
"ipConfigurations": [
{
"name": "ipconfig1",
"properties": {
"subnet": {
"id": "[variables('subnetRef')]"
},
"privateIPAllocationMethod": "Dynamic"
}
}
]
}
},
{
"name": "[parameters('diagnosticsStorageAccountName')]",
"type": "Microsoft.Storage/storageAccounts",
"apiVersion": "2019-06-01",
"location": "[resourceGroup().location]",
"kind": "StorageV2",
"sku": {
"name": "Standard_LRS",
"tier": "Standard"
}
},
{
"type": "Microsoft.Compute/virtualMachines",
"apiVersion": "2019-07-01",
"name": "[parameters('virtualMachineName')]",
"location": "[parameters('location')]",
"dependsOn": [
"[concat('Microsoft.Network/networkInterfaces/', parameters('networkInterfaceName'))]",
"[parameters('diagnosticsStorageAccountName')]"
],
"identity": {
"type": "systemAssigned"
},
"plan": {
"name": "12_1-release",
"publisher": "thefreebsdfoundation",
"product": "freebsd-12_1"
},
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('virtualMachineSize')]"
},
"storageProfile": {
"osDisk": {
"createOption": "fromImage",
"managedDisk": {
"storageAccountType": "[parameters('osDiskType')]"
}
},
"imageReference": {
"id": "[parameters('imageId')]"
}
},
"networkProfile": {
"networkInterfaces": [
{
"id": "[resourceId('Microsoft.Network/networkInterfaces', parameters('networkInterfaceName'))]"
}
]
},
"osProfile": {
"computerName": "[parameters('virtualMachineName')]",
"adminUsername": "[parameters('adminUsername')]",
"linuxConfiguration": {
"disablePasswordAuthentication": true,
"ssh": {
"publicKeys": [
{
"path": "[concat('/home/', parameters('adminUsername'), '/.ssh/authorized_keys')]",
"keyData": "[parameters('adminPublicKey')]"
}
]
}
}
},
"diagnosticsProfile": {
"bootDiagnostics": {
"enabled": true,
"storageUri": "[concat('https://', parameters('diagnosticsStorageAccountName'), '.blob.core.windows.net/')]"
}
}
}
}
],
"outputs": {
"adminUsername": {
"type": "String",
"value": "[parameters('adminUsername')]"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment