Skip to content

Commit

Permalink
works!
Browse files Browse the repository at this point in the history
  • Loading branch information
Crowell authored and Crowell committed Apr 4, 2017
1 parent c0f31e1 commit 96af3c4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"adminPassword": {
"reference": {
"keyVault": {
"id": "/subscriptions/4830d36a-e5da-4f38-8647-b8ca702c1b1d/resourceGroups/vchds-root-rg/providers/Microsoft.KeyVault/vaults/vchDsKeyVault"
},
"secretName": "VmAdminPassword"
}
}
// "dnsLabelPrefix": {
// "value": "GEN-UNIQUE"
// },
// "windowsOSVersion": {
// "value": "2012-R2-Datacenter"
// }
}
}
16 changes: 12 additions & 4 deletions json_deployment_templates/vch-iaas-deployment/deploy.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
Set-Location -Path $PSScriptRoot
$template_path = Join-Path -Path $PSScriptRoot -ChildPath "template.json"
$template_path = "template.json"
Login-AzureRmAccount
$parameter_path = "azuredeploy.parameters.json"
# Login-AzureRmAccount
# Set-AzureRmContext -SubscriptionID {your-subscription-ID}
New-AzureRmResourceGroup -Name rg1 -Location "canadacentral"
Test-AzureRmResourceGroupDeployment -ResourceGroupName rg1 -TemplateFile $template_path -Verbose -Debug
New-AzureRmResourceGroupDeployment -Name rg1 -ResourceGroupName rg1 -TemplateFile $template_path

$Secret = Read-Host -AsSecureString -Prompt "Enter VM local admin password. `nIt will save/OVERWRITE secret: VmAdminPassword `nin Key vault: vchDsKeyVault"
# save pass word to Azure Key Vault
Set-AzureKeyVaultSecret -VaultName 'vchDsKeyVault' -Name 'VmAdminPassword' -SecretValue $Secret
# enable Key Vault for template deployment
Set-AzureRmKeyVaultAccessPolicy -VaultName 'vchDsKeyVault' -EnabledForTemplateDeployment

New-AzureRmResourceGroup -Name rg2 -Location "canadacentral"
Test-AzureRmResourceGroupDeployment -ResourceGroupName rg2 -TemplateFile $template_path -TemplateParameterFile $parameter_path -Verbose -Debug
New-AzureRmResourceGroupDeployment -Name gcdeployment -ResourceGroupName rg2 -TemplateFile $template_path -TemplateParameterFile $parameter_path
28 changes: 20 additions & 8 deletions json_deployment_templates/vch-iaas-deployment/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,19 @@
"vmSize": "Standard_DS13_v2"

}
},
"adminName": {
"type": "string",
"defaultValue": "Floater1",
"metadata": {
"description": "VM admin user name."
}
},
"adminPassword": {
"type": "securestring",
"metadata": {
"description": "VM admin password."
}
}
},
"variables": {
Expand All @@ -41,7 +54,7 @@
"type": "Microsoft.Network/virtualNetworks",
"name": "[parameters('virtualNetworkName')]",
"apiVersion": "2016-03-30",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"properties": {
"addressSpace": {
"addressPrefixes": [
Expand Down Expand Up @@ -70,7 +83,7 @@
"type": "Microsoft.Network/networkSecurityGroups",
"name": "[variables('adNsgName')]",
"apiVersion": "2016-03-30",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"properties": {
"securityRules": [{
"name": "rdp-rule",
Expand Down Expand Up @@ -100,7 +113,7 @@
"count": "[parameters('workLoadAd')['count']]"
},
"apiVersion": "2016-04-30-preview",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"properties": {
"hardwareProfile": {
"vmSize": "[parameters('workLoadAd')['vmSize']]"
Expand All @@ -125,7 +138,8 @@
},
"osProfile": {
"computerName": "[concat(variables('adVmName'), copyIndex())]",
"adminUsername": "Floater1",
"adminUsername": "[parameters('adminName')]",
"adminPassword": "[parameters('adminPassword')]",
"windowsConfiguration": {
"provisionVMAgent": true,
"enableAutomaticUpdates": true
Expand Down Expand Up @@ -158,7 +172,7 @@
},
"name": "[concat(variables('adVmName'), copyIndex(),'Nic')]",
"apiVersion": "2016-03-30",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"properties": {
"ipConfigurations": [{
"name": "ipconfig1",
Expand All @@ -182,8 +196,6 @@
}
},
"dependsOn": [
// "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]",
// "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('adVmName'), copyIndex(),'Nic'))]",
"[resourceId('Microsoft.Network/publicIPAddresses', concat(variables('adVmName'), copyIndex(),'Pip'))]",
"[resourceId('Microsoft.Network/virtualNetworks', parameters('virtualNetworkName'))]",
"[resourceId('Microsoft.Network/networkSecurityGroups', variables('adNsgName'))]"
Expand All @@ -198,7 +210,7 @@
"count": "[parameters('workLoadAd')['count']]"
},
"apiVersion": "2016-03-30",
"location": "[parameters('location')]",
"location": "[resourceGroup().location]",
"properties": {
"publicIPAllocationMethod": "Static",
"idleTimeoutInMinutes": 4,
Expand Down

0 comments on commit 96af3c4

Please sign in to comment.