Merge remote-tracking branch 'refs/remotes/Azure/master'
This commit is contained in:
Коммит
76c748ad57
|
@ -1,42 +1,20 @@
|
||||||
# Create a SQL Server 2014 Always On Availability Group with PowerShell DSC Extension
|
# Create a AD domain controller server non-HA with PowerShell DSC Extension
|
||||||
|
|
||||||
This template will create a SQL Server 2014 Always On Availability Group using the PowerShell DSC Extension it creates the following resources:
|
This template will create a AD domain controller Server using the PowerShell DSC Extension; it creates the following resources:
|
||||||
|
|
||||||
+ A Virtual Network
|
+ A Virtual Network
|
||||||
+ Three Storage Accounts
|
+ One Storage Account
|
||||||
+ One external and one internal load balancer
|
+ One external load balancer
|
||||||
+ Two VMs configured as Domain Controllers for a new forest with a single domain
|
+ One VM configured as Domain Controller for a new forest with a single domain
|
||||||
+ Three VMs in a Windows Server Cluster, two VMs run SQL Server 2014 with an availability group and the third is a File Share Witness for the Cluster
|
|
||||||
+ Two Availability Sets one for the AD VMs, the other for the SQL and Witness VMs, the second Availability Set is configured with three Update Domains and three Fault Domains
|
|
||||||
|
|
||||||
The external load balancer creates an RDP NAT rule to allow connectivity to the first VM created, in order to access other VMs in the deployment this VM should be used as a jumpbox.
|
The external load balancer creates an RDP NAT rule to allow connectivity to the AD VM created.
|
||||||
|
|
||||||
A SQL Server always on listener is created using the internal load balancer.
|
|
||||||
|
|
||||||
# Known Issues
|
|
||||||
|
|
||||||
This template is entirely serial due to some issues between the platform agent and the DSC extension which cause problems when multiple VM and\or extension resources are deployed concurrently. This issue will be fixed as soon as possible.
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
+ The default settings for storage are to deploy using **premium storage**, the AD VMs use a P10 Disk and the SQL VMs use two P30 disks each, these sizes can be changed by changing the relevant variables. In addition there is a P10 Disk used for each VMs OS Disk.
|
|
||||||
|
|
||||||
+ In default settings for compute require that you have at least 19 cores of free quota to deploy.
|
|
||||||
|
|
||||||
+ The images used to create this deployment are
|
+ The images used to create this deployment are
|
||||||
+ AD - Latest Windows Server 2012 R2 Image
|
+ AD - Latest Windows Server 2012 R2 Image
|
||||||
+ SQL Server - Latest SQL Server 2014 on Windows Server 2012 R2 Image
|
|
||||||
+ Witness - Latest Windows Server 2012 R2 Image
|
|
||||||
|
|
||||||
+ The image configuration is defined in variables - details below - but the scripts that configure this deployment have only been tested with these versions and may not work on other images.
|
|
||||||
|
|
||||||
|
|
||||||
Click the button below to deploy from the portal
|
|
||||||
|
|
||||||
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fsql-server-2014-alwayson-dsc%2Fazuredeploy.json" target="_blank">
|
|
||||||
<img src="http://azuredeploy.net/deploybutton.png"/>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
|
+ The image configuration is defined in variables - details below - but the scripts that configure this deployment have only been tested with version mentioned above and may not work on other images.
|
||||||
|
|
||||||
## Deploying from PowerShell
|
## Deploying from PowerShell
|
||||||
|
|
||||||
|
@ -44,46 +22,10 @@ For details on how to install and configure Azure Powershell see [here].(https:/
|
||||||
|
|
||||||
Launch a PowerShell console
|
Launch a PowerShell console
|
||||||
|
|
||||||
Ensure that you are in Resource Manager Mode
|
|
||||||
|
|
||||||
```PowerShell
|
|
||||||
|
|
||||||
Switch-AzureMode AzureResourceManager
|
|
||||||
|
|
||||||
```
|
```
|
||||||
Change working folder to the folder containing this template
|
Change working folder to the folder containing this template
|
||||||
|
|
||||||
```PowerShell
|
```PowerShell
|
||||||
|
|
||||||
New-AzureResourceGroup -Name "<new resourcegroup name>" -Location "<new resourcegroup location>" -TemplateParameterFile .\azuredeploy-parameters.json -TemplateFile .\azuredeploy.json
|
New-AzurermResourceGroupDeployment -Name "<new resourcegroup name>" -Location "<new resourcegroup location>" -TemplateParameterFile .\azuredeploy.azurestack.parameters.json -TemplateFile .\azuredeploy.json
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
You will be prompted for the following parameters
|
|
||||||
|
|
||||||
+ **newStorageAccountNamePrefix:** - specify the prefix for the new storage account names
|
|
||||||
+ **locationFromTemplate:** - specify a valid location for the deployment
|
|
||||||
+ **adminPassword:** - the administrator password for the VMs and Domain
|
|
||||||
+ **sqlServerServiceAccountPassword:** the password for the account that SQL Server will run as
|
|
||||||
+ **dnsPrefix:** the DNS prefix for the public IP address used for RDP
|
|
||||||
|
|
||||||
## Notable Variables
|
|
||||||
|
|
||||||
|Name|Description|
|
|
||||||
|:---|:---------------------|
|
|
||||||
|virtualNetworkName|Name of the Virtual Network|
|
|
||||||
|adPDCVMName|The name of the Primary Domain Controller|
|
|
||||||
|adBDCVMName|The name of the Backup\Second Domain Controller|
|
|
||||||
|sqlVMName|The prefix for the SQL VM Names|
|
|
||||||
|sqlwVMName|The name of the File Share Witness|
|
|
||||||
|spwebVMName|The Prefix of the SharePoint Web Server VMs|
|
|
||||||
|rdpPort|The public RDP port for first VM|
|
|
||||||
|windowsImagePublisher|The name of the pulisher of the AD and Witness Image|
|
|
||||||
|windowsImageOffer|The Offer Name for the Image used by AD and Witness VMs|
|
|
||||||
|windowsImageSKU|The Image SKU for the AD and Witness Image|
|
|
||||||
|sqlImagePublisher|The name of the pulisher of the SQL Image|
|
|
||||||
|sqlImageOffer|The Offer Name for the Image used by SQL|
|
|
||||||
|sqlImageSKU|The Image SKU for the SQL Image|
|
|
||||||
|windowsDiskSize|The size of the VHD allocated for AD and Witness VMs Data Disk|
|
|
||||||
|sqlDiskSize|The size of the VHD allocated for SQL VMs Data and Log Disks|
|
|
||||||
|domainName|The name of the new AD Domain created|
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"defaultValue": "azurestack.local",
|
"defaultValue": "azurestack.local",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": "The address of Primary AD"
|
"description": "the storage account domain"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
###########
|
||||||
|
# CONNECT #
|
||||||
|
###########
|
||||||
|
|
||||||
|
# Add specific Azure Stack Environment
|
||||||
|
$AadTenantId = "3dc25382-d7d1-4e5a-ad19-2fb47f1571c2" #GUID Specific to the AAD Tenant
|
||||||
|
|
||||||
|
Add-AzureRmEnvironment -Name 'Azure Stack' `
|
||||||
|
-ActiveDirectoryEndpoint ("https://login.windows.net/$AadTenantId/") `
|
||||||
|
-ActiveDirectoryServiceEndpointResourceId "https://azurestack.local-api/" `
|
||||||
|
-ResourceManagerEndpoint ("https://api.azurestack.local/") `
|
||||||
|
-GalleryEndpoint ("https://gallery.azurestack.local:30016/") `
|
||||||
|
-GraphEndpoint "https://graph.windows.net/"
|
||||||
|
|
||||||
|
# Get Azure Stack Environment Information
|
||||||
|
$env = Get-AzureRmEnvironment 'Azure Stack'
|
||||||
|
|
||||||
|
# Authenticate to AAD with Azure Stack Environment
|
||||||
|
Add-AzureRmAccount -Environment $env -Verbose
|
||||||
|
|
||||||
|
# Get Azure Stack Environment Subscription
|
||||||
|
$SubName = "Best Sub"
|
||||||
|
Get-AzureRmSubscription -SubscriptionName $SubName | Select-AzureRmSubscription
|
|
@ -0,0 +1,13 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$RGName = 'myRG001'
|
||||||
|
$depName = 'myVNDeployment001'
|
||||||
|
|
||||||
|
# Deploy vNet Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name $depName `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-vNet.json"
|
|
@ -0,0 +1,115 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {},
|
||||||
|
"variables": {
|
||||||
|
"nicName": "myNic",
|
||||||
|
"publicIPAddressName": "myPubIP",
|
||||||
|
"vnetName": "myVNet",
|
||||||
|
"nsgName": "myNsg",
|
||||||
|
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
||||||
|
"addressPrefix": "10.0.0.0/24",
|
||||||
|
"subnetName": "Subnet-1",
|
||||||
|
"subnetPrefix": "10.0.0.0/24",
|
||||||
|
"publicIPAddressType": "Dynamic",
|
||||||
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('vnetName'))]",
|
||||||
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables ('subnetName'))]",
|
||||||
|
"publicIPAddressID": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]",
|
||||||
|
"numberOfInstances": 1
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkSecurityGroups",
|
||||||
|
"name": "[variables('nsgName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"securityRules": [
|
||||||
|
{
|
||||||
|
"name": "rule1",
|
||||||
|
"properties": {
|
||||||
|
"protocol": "*",
|
||||||
|
"sourcePortRange": "*",
|
||||||
|
"destinationPortRange": "*",
|
||||||
|
"sourceAddressPrefix": "*",
|
||||||
|
"destinationAddressPrefix": "*",
|
||||||
|
"access": "Allow",
|
||||||
|
"priority": 101,
|
||||||
|
"direction": "Inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/publicIPAddresses",
|
||||||
|
"name": "[variables('publicIPAddressName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('vnetName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnetName')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnetPrefix')]",
|
||||||
|
"networkSecurityGroup": {
|
||||||
|
"id": "[variables('nsgID')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dhcpOptions": {
|
||||||
|
"dnsServers": ["192.168.100.2"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkInterfaces",
|
||||||
|
"name": "[concat(variables('nicName'), copyindex())]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"copy": {
|
||||||
|
"name": "nicLoop",
|
||||||
|
"count": "[variables('numberOfInstances')]"
|
||||||
|
},
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/virtualNetworks/', variables('vnetName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ipConfigurations": [
|
||||||
|
{
|
||||||
|
"name": "ipconfig1",
|
||||||
|
"properties": {
|
||||||
|
"privateIPAllocationMethod": "Dynamic",
|
||||||
|
"subnet": {
|
||||||
|
"id": "[variables('subnetRef')]"
|
||||||
|
},
|
||||||
|
"loadBalancerInboundNatRules": [
|
||||||
|
{
|
||||||
|
"id": "[concat(variables('lbID'),'/inboundNatRules/RDP-VM', copyindex())]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {},
|
||||||
|
"variables": {
|
||||||
|
"networkSecurityGroupName": "mySG"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkSecurityGroups",
|
||||||
|
"name": "[variables('networkSecurityGroupName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"tags": {
|
||||||
|
"displayName": "NetworkSecurityGroup"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"securityRules": [
|
||||||
|
{
|
||||||
|
"name": "rule1",
|
||||||
|
"properties": {
|
||||||
|
"protocol": "*",
|
||||||
|
"sourcePortRange": "*",
|
||||||
|
"destinationPortRange": "*",
|
||||||
|
"sourceAddressPrefix": "*",
|
||||||
|
"destinationAddressPrefix": "*",
|
||||||
|
"access": "Allow",
|
||||||
|
"priority": 101,
|
||||||
|
"direction": "Inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {},
|
||||||
|
"variables": {
|
||||||
|
"vnetName": "myVNet",
|
||||||
|
"addressPrefix": "10.0.0.0/24",
|
||||||
|
"subnetName": "Subnet-1",
|
||||||
|
"subnetPrefix": "10.0.0.0/24"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('vnetName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnetName')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnetPrefix')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dhcpOptions": {
|
||||||
|
"dnsServers": ["192.168.100.2"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,68 @@
|
||||||
|
{
|
||||||
|
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {},
|
||||||
|
"variables": {
|
||||||
|
"vnetName": "myVNet",
|
||||||
|
"nsgName": "myNsg",
|
||||||
|
"nsgID": "[resourceId('Microsoft.Network/networkSecurityGroups',variables('nsgName'))]",
|
||||||
|
"addressPrefix": "10.0.0.0/24",
|
||||||
|
"subnetName": "Subnet-1",
|
||||||
|
"subnetPrefix": "10.0.0.0/24"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkSecurityGroups",
|
||||||
|
"name": "[variables('nsgName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"securityRules": [
|
||||||
|
{
|
||||||
|
"name": "rule1",
|
||||||
|
"properties": {
|
||||||
|
"protocol": "*",
|
||||||
|
"sourcePortRange": "*",
|
||||||
|
"destinationPortRange": "*",
|
||||||
|
"sourceAddressPrefix": "*",
|
||||||
|
"destinationAddressPrefix": "*",
|
||||||
|
"access": "Allow",
|
||||||
|
"priority": 101,
|
||||||
|
"direction": "Inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('vnetName')]",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnetName')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnetPrefix')]",
|
||||||
|
"networkSecurityGroup": {
|
||||||
|
"id": "[variables('nsgID')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dhcpOptions": {
|
||||||
|
"dnsServers": ["192.168.100.2"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$storageacct = 'mystorage001'
|
||||||
|
$RGName = 'myRG001'
|
||||||
|
$depName = 'mySADeployment001'
|
||||||
|
|
||||||
|
# Deploy Storage Account Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name $depName `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-storageacct.json" `
|
||||||
|
-newStorageAccountName $storageacct
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"newStorageAccountName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the Storage Account"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storageAccountType": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "Standard_LRS",
|
||||||
|
"allowedValues": [
|
||||||
|
"Standard_LRS"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Storage Account type"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "local",
|
||||||
|
"allowedValues": [
|
||||||
|
"local"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Location of storage account"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Storage/storageAccounts",
|
||||||
|
"name": "[parameters('newStorageAccountName')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"properties": {
|
||||||
|
"accountType": "[parameters('storageAccountType')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$myNum = "001" #Modify this per deployment
|
||||||
|
$RGName = "myRG$myNum"
|
||||||
|
$myLocation = "local"
|
||||||
|
$myBlobStorageEndpoint = "blob.azurestack.local"
|
||||||
|
|
||||||
|
# Create Resource Group for Template Deployment
|
||||||
|
New-AzureRMResourceGroup -Name $RGName -Location $myLocation
|
||||||
|
|
||||||
|
# Deploy Simple IaaS Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name "myDeploymen$myNum" `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-101-simple-windows-vm-withDNS.json" `
|
||||||
|
-deploymentLocation $myLocation `
|
||||||
|
-blobStorageEndpoint $myBlobStorageEndpoint `
|
||||||
|
-newStorageAccountName "mystorage$myNum" `
|
||||||
|
-dnsNameForPublicIP "mydns$myNum" `
|
||||||
|
-adminUsername "admin" `
|
||||||
|
-adminPassword ("User@123" | ConvertTo-SecureString -AsPlainText -Force) `
|
||||||
|
-vmName "myVM$myNum" `
|
||||||
|
-windowsOSVersion "2012-R2-Datacenter"
|
|
@ -0,0 +1,248 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "This is the name of your virtual machine"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"osDiskUrlParam": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "URL to OS disk resource"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dataDiskUrlParam": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "URL to data disk resource"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dnsNameForPublicIP": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminUserName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "UserName for the Virtual Machine"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminPassword": {
|
||||||
|
"type": "securestring",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Password for the Virtual Machine"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"osType": {
|
||||||
|
"type": "string",
|
||||||
|
"allowedValues": [
|
||||||
|
"windows",
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "This is the OS that your VM will be running"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"location": {
|
||||||
|
"type": "string",
|
||||||
|
"allowedValues": [
|
||||||
|
"West US",
|
||||||
|
"East US",
|
||||||
|
"East Asia",
|
||||||
|
"Southeast Asia",
|
||||||
|
"West Europe",
|
||||||
|
"local"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Location where resources will be deployed"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vmSize": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "Standard_A3",
|
||||||
|
"allowedValues": [
|
||||||
|
"Standard_A1",
|
||||||
|
"Standard_A2",
|
||||||
|
"Standard_A3",
|
||||||
|
"Standard_A4"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "This is the size of your VM"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"networkApiVersion": "2015-05-01-preview",
|
||||||
|
"computeApiVersion": "2015-06-15",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"publicIPAddressName": "[concat(parameters('vmName'),'PublicIP')]",
|
||||||
|
"vmName": "[parameters('vmName')]",
|
||||||
|
"virtualNetworkName": "[concat(parameters('vmName'),'VNet')]",
|
||||||
|
"nicName": "[concat(parameters('vmName'),'Nic')]",
|
||||||
|
"addressPrefix": "10.0.0.0/24",
|
||||||
|
"subnet1Name": "mysubnet",
|
||||||
|
"subnet1Prefix": "10.0.0.0/24",
|
||||||
|
"publicIPAddressType": "Dynamic",
|
||||||
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||||
|
"subnet1Ref": "[concat(variables('vnetID'),'/subnets/',variables('subnet1Name'))]",
|
||||||
|
"networkSecurityGroupName": "SecurityGroup",
|
||||||
|
"osDiskUrl": "[parameters('osDiskUrlParam')]",
|
||||||
|
"dataDiskUrl": "[parameters('dataDiskUrlParam')]",
|
||||||
|
"osDiskVhdName": "[concat(variables('osDiskUrl'),'-',variables('vmName'),'.vhd')]",
|
||||||
|
"dataDiskVhdName": "[concat(variables('dataDiskUrl'),'-',variables('vmName'),'.vhd')]"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('networkApiVersion')]",
|
||||||
|
"type": "Microsoft.Network/networkSecurityGroups",
|
||||||
|
"name": "[variables('networkSecurityGroupName')]",
|
||||||
|
"location": "[parameters('location')]",
|
||||||
|
"tags": {
|
||||||
|
"displayName": "NetworkSecurityGroup"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"securityRules": [
|
||||||
|
{
|
||||||
|
"name": "rule1",
|
||||||
|
"properties": {
|
||||||
|
"protocol": "*",
|
||||||
|
"sourcePortRange": "*",
|
||||||
|
"destinationPortRange": "*",
|
||||||
|
"sourceAddressPrefix": "*",
|
||||||
|
"destinationAddressPrefix": "*",
|
||||||
|
"access": "Allow",
|
||||||
|
"priority": 101,
|
||||||
|
"direction": "Inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('networkApiVersion')]",
|
||||||
|
"type": "Microsoft.Network/publicIPAddresses",
|
||||||
|
"name": "[variables('publicIPAddressName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"properties": {
|
||||||
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||||
|
"dnsSettings": {
|
||||||
|
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('networkApiVersion')]",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('virtualNetworkName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnet1Name')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnet1Prefix')]",
|
||||||
|
"networkSecurityGroup": {
|
||||||
|
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dhcpOptions": {
|
||||||
|
"dnsServers": ["192.168.100.2"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('networkApiVersion')]",
|
||||||
|
"type": "Microsoft.Network/networkInterfaces",
|
||||||
|
"name": "[variables('nicName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||||
|
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ipConfigurations": [
|
||||||
|
{
|
||||||
|
"name": "ipconfig1",
|
||||||
|
"properties": {
|
||||||
|
"privateIPAllocationMethod": "Dynamic",
|
||||||
|
"publicIPAddress": {
|
||||||
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||||
|
},
|
||||||
|
"subnet": {
|
||||||
|
"id": "[variables('subnet1Ref')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "[variables('computeApiVersion')]",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"name": "[variables('vmName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "[parameters('vmSize')]"
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "[variables('vmName')]",
|
||||||
|
"adminUsername": "[parameters('adminUsername')]",
|
||||||
|
"adminPassword": "[parameters('adminPassword')]"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"dataDisks": [
|
||||||
|
{
|
||||||
|
"name": "[concat(variables('vmName'),'-dataDisk')]",
|
||||||
|
"lun": 0,
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"image": {
|
||||||
|
"uri": "[variables('dataDiskUrl')]"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "[variables('dataDiskVhdName')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"osDisk": {
|
||||||
|
"name": "[concat(variables('vmName'),'-osDisk')]",
|
||||||
|
"osType": "[parameters('osType')]",
|
||||||
|
"caching": "ReadWrite",
|
||||||
|
"createOption": "FromImage",
|
||||||
|
"image": {
|
||||||
|
"uri": "[variables('osDiskUrl')]"
|
||||||
|
},
|
||||||
|
"vhd": {
|
||||||
|
"uri": "[variables('osDiskVhdName')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,246 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"newStorageAccountName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Unique DNS Name for the Storage Account where the Virtual Machine's disks will be placed."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the VM."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"blobStorageEndpoint": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "blob.azurestack.local",
|
||||||
|
"allowedValues": [
|
||||||
|
"blob.azurestack.local",
|
||||||
|
"blob.core.windows.net"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Blob storage endpoint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
"deploymentLocation": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "local",
|
||||||
|
"allowedValues": [
|
||||||
|
"local",
|
||||||
|
"westus",
|
||||||
|
"eastus"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "Blob storage endpoint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminUsername": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Username for the Virtual Machine."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"adminPassword": {
|
||||||
|
"type": "securestring",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Password for the Virtual Machine."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dnsNameForPublicIP": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Unique DNS Name for the Public IP used to access the Virtual Machine."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"windowsOSVersion": {
|
||||||
|
"type": "string",
|
||||||
|
"defaultValue": "2012-R2-Datacenter",
|
||||||
|
"allowedValues": [
|
||||||
|
"2008-R2-SP1",
|
||||||
|
"2012-Datacenter",
|
||||||
|
"2012-R2-Datacenter"
|
||||||
|
],
|
||||||
|
"metadata": {
|
||||||
|
"description": "The Windows version for the VM. This will pick a fully patched image of this given Windows version. Allowed values: 2008-R2-SP1, 2012-Datacenter, 2012-R2-Datacenter."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
"location": "[parameters('deploymentLocation')]",
|
||||||
|
"imagePublisher": "MicrosoftWindowsServer",
|
||||||
|
"imageOffer": "WindowsServer",
|
||||||
|
"OSDiskName": "osdisk",
|
||||||
|
"nicName": "myVnic",
|
||||||
|
"addressPrefix": "10.0.0.0/24",
|
||||||
|
"subnetName": "mySubnet",
|
||||||
|
"subnetPrefix": "10.0.0.0/24",
|
||||||
|
"storageAccountType": "Standard_LRS",
|
||||||
|
"publicIPAddressName": "myPublicIP",
|
||||||
|
"publicIPAddressType": "Dynamic",
|
||||||
|
"vmStorageAccountContainerName": "vhds",
|
||||||
|
"vmSize": "Standard_A1",
|
||||||
|
"virtualNetworkName": "myVnet",
|
||||||
|
"vnetID": "[resourceId('Microsoft.Network/virtualNetworks',variables('virtualNetworkName'))]",
|
||||||
|
"subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
|
||||||
|
"networkSecurityGroupName": "mySG"
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkSecurityGroups",
|
||||||
|
"name": "[variables('networkSecurityGroupName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"tags": {
|
||||||
|
"displayName": "NetworkSecurityGroup"
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"securityRules": [
|
||||||
|
{
|
||||||
|
"name": "rule1",
|
||||||
|
"properties": {
|
||||||
|
"protocol": "*",
|
||||||
|
"sourcePortRange": "*",
|
||||||
|
"destinationPortRange": "*",
|
||||||
|
"sourceAddressPrefix": "*",
|
||||||
|
"destinationAddressPrefix": "*",
|
||||||
|
"access": "Allow",
|
||||||
|
"priority": 101,
|
||||||
|
"direction": "Inbound"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Storage/storageAccounts",
|
||||||
|
"name": "[parameters('newStorageAccountName')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"properties": {
|
||||||
|
"accountType": "[variables('storageAccountType')]"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/publicIPAddresses",
|
||||||
|
"name": "[variables('publicIPAddressName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"properties": {
|
||||||
|
"publicIPAllocationMethod": "[variables('publicIPAddressType')]",
|
||||||
|
"dnsSettings": {
|
||||||
|
"domainNameLabel": "[parameters('dnsNameForPublicIP')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/virtualNetworks",
|
||||||
|
"name": "[variables('virtualNetworkName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/networkSecurityGroups/', variables('networkSecurityGroupName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"addressSpace": {
|
||||||
|
"addressPrefixes": [
|
||||||
|
"[variables('addressPrefix')]"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subnets": [
|
||||||
|
{
|
||||||
|
"name": "[variables('subnetName')]",
|
||||||
|
"properties": {
|
||||||
|
"addressPrefix": "[variables('subnetPrefix')]",
|
||||||
|
"networkSecurityGroup": {
|
||||||
|
"id": "[resourceId('Microsoft.Network/networkSecurityGroups', variables('networkSecurityGroupName'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dhcpOptions": {
|
||||||
|
"dnsServers": ["192.168.100.2"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-05-01-preview",
|
||||||
|
"type": "Microsoft.Network/networkInterfaces",
|
||||||
|
"name": "[variables('nicName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]",
|
||||||
|
"[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"ipConfigurations": [
|
||||||
|
{
|
||||||
|
"name": "ipconfig1",
|
||||||
|
"properties": {
|
||||||
|
"privateIPAllocationMethod": "Dynamic",
|
||||||
|
"publicIPAddress": {
|
||||||
|
"id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]"
|
||||||
|
},
|
||||||
|
"subnet": {
|
||||||
|
"id": "[variables('subnetRef')]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"type": "Microsoft.Compute/virtualMachines",
|
||||||
|
"name": "[parameters('vmName')]",
|
||||||
|
"location": "[variables('location')]",
|
||||||
|
"dependsOn": [
|
||||||
|
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
||||||
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"hardwareProfile": {
|
||||||
|
"vmSize": "[variables('vmSize')]"
|
||||||
|
},
|
||||||
|
"osProfile": {
|
||||||
|
"computerName": "[parameters('vmName')]",
|
||||||
|
"adminUsername": "[parameters('adminUsername')]",
|
||||||
|
"adminPassword": "[parameters('adminPassword')]"
|
||||||
|
},
|
||||||
|
"storageProfile": {
|
||||||
|
"imageReference": {
|
||||||
|
"publisher": "[variables('imagePublisher')]",
|
||||||
|
"offer": "[variables('imageOffer')]",
|
||||||
|
"sku": "[parameters('windowsOSVersion')]",
|
||||||
|
"version": "latest"
|
||||||
|
},
|
||||||
|
"osDisk": {
|
||||||
|
"name": "osdisk",
|
||||||
|
"vhd": {
|
||||||
|
"uri": "[concat('http://',parameters('newStorageAccountName'),'.', parameters('blobStorageEndpoint'), '/', variables('vmStorageAccountContainerName'),'/',variables('OSDiskName'),'.vhd')]"
|
||||||
|
},
|
||||||
|
"caching": "ReadWrite",
|
||||||
|
"createOption": "FromImage"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"networkProfile": {
|
||||||
|
"networkInterfaces": [
|
||||||
|
{
|
||||||
|
"id": "[resourceId('Microsoft.Network/networkInterfaces',variables('nicName'))]"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"diagnosticsProfile": {
|
||||||
|
"bootDiagnostics": {
|
||||||
|
"enabled": "true",
|
||||||
|
"storageUri": "[concat('http://',parameters('newStorageAccountName'),'.', parameters('blobStorageEndpoint'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$vmName = 'myVM001'
|
||||||
|
$RGName = 'myRG001'
|
||||||
|
$depName = 'myBGIDeployment001'
|
||||||
|
|
||||||
|
# Deploy BGInfo Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name $depName `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-bginfo.json" `
|
||||||
|
-vmName $vmName
|
|
@ -0,0 +1,15 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$vmName = 'myVM001'
|
||||||
|
$RGName = 'myRG001'
|
||||||
|
$depName = 'myCSDeployment001'
|
||||||
|
|
||||||
|
# Deploy Custom Script Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name $depName `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-customscript-command.json" `
|
||||||
|
-vmName $vmName
|
|
@ -0,0 +1,17 @@
|
||||||
|
##########
|
||||||
|
# DEPLOY #
|
||||||
|
##########
|
||||||
|
|
||||||
|
# Set Deployment Variables
|
||||||
|
$vmName = 'myVM001'
|
||||||
|
$RGName = 'myRG001'
|
||||||
|
$depName = 'myDSCDeployment001'
|
||||||
|
|
||||||
|
# Deploy DSC Extension Template
|
||||||
|
New-AzureRmResourceGroupDeployment `
|
||||||
|
-Name $depName `
|
||||||
|
-ResourceGroupName $RGName `
|
||||||
|
-TemplateFile "c:\templates\azuredeploy-dsc.json" `
|
||||||
|
-TemplateParameterFile "C:\templates\azuredeploy-dsc.parameters.json" `
|
||||||
|
-vmName $vmName `
|
||||||
|
-timestamp (Get-Date)
|
|
@ -0,0 +1,12 @@
|
||||||
|
$rgName = "myRG001"
|
||||||
|
$vmName = "myVM001"
|
||||||
|
$extName = "VMAccess"
|
||||||
|
|
||||||
|
#Get VMAccessAgent Extension Info (throws error if notexists)
|
||||||
|
Get-AzureRmVMAccessExtension -ResourceGroupName $rgName -VMName $vmName -Name $extName
|
||||||
|
|
||||||
|
# Set VMAccessAgent Extension (Reset Password)
|
||||||
|
Set-AzureRmVMAccessExtension -ResourceGroupName $rgName -VMName $vmName -Name $extName -UserName "admin" -Password "User@123" -Location "Local"
|
||||||
|
|
||||||
|
# Remove VMAccessAgent Extension
|
||||||
|
Remove-AzureRmVMAccessExtension -ResourceGroupName $rgName -VMName $vmName -Name $extName
|
|
@ -0,0 +1,45 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply the VM Extensions to"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "CustomScriptExtension",
|
||||||
|
"typeHandlerVersion": "1.4",
|
||||||
|
"settings": {
|
||||||
|
"commandToExecute": "md c:\\users\\public\\documents\\test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/BGInfo')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "BGInfo",
|
||||||
|
"typeHandlerVersion": "2.1",
|
||||||
|
"settings": {
|
||||||
|
"Properties": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply BGInfo to"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/BGInfo')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "BGInfo",
|
||||||
|
"typeHandlerVersion": "2.1",
|
||||||
|
"settings": {
|
||||||
|
"Properties": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply the custom script to"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "CustomScriptExtension",
|
||||||
|
"typeHandlerVersion": "1.4",
|
||||||
|
"settings": {
|
||||||
|
"commandToExecute": "md c:\\users\\public\\documents\\test"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply the custom script to"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "CustomScriptExtension",
|
||||||
|
"typeHandlerVersion": "1.4",
|
||||||
|
"settings": {
|
||||||
|
"commandToExecute": "powershell -ExecutionPolicy Unrestricted Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.100.2, 8.8.8.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply Linux custom script to"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/CustomScriptForLinux')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.OSTCExtensions",
|
||||||
|
"type": "CustomScriptForLinux",
|
||||||
|
"typeHandlerVersion": "1.3",
|
||||||
|
"settings": {
|
||||||
|
"commandToExecute": "ifconfig"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,43 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
|
||||||
|
"contentVersion": "1.0.0.0",
|
||||||
|
"parameters": {
|
||||||
|
"vmName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Name of the existing VM to apply the custom script to"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scriptFile": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Full path of the script file in blob storage (Azure or Azure Stack)"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scriptName": {
|
||||||
|
"type": "string",
|
||||||
|
"metadata": {
|
||||||
|
"description": "Full name of the script file (including extension) referenced in the scriptFile parameter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"variables": {
|
||||||
|
},
|
||||||
|
"resources": [
|
||||||
|
{
|
||||||
|
"type": "Microsoft.Compute/virtualMachines/extensions",
|
||||||
|
"name": "[concat(parameters('vmName'),'/CustomScriptExtension')]",
|
||||||
|
"apiVersion": "2015-06-15",
|
||||||
|
"location": "[resourceGroup().location]",
|
||||||
|
"properties": {
|
||||||
|
"publisher": "Microsoft.Compute",
|
||||||
|
"type": "CustomScriptExtension",
|
||||||
|
"typeHandlerVersion": "1.4",
|
||||||
|
"settings": {
|
||||||
|
"fileUris": [ "[parameters('scriptFile')]" ],
|
||||||
|
"commandToExecute": "[concat('powershell -ExecutionPolicy Unrestricted -file ',parameters('scriptName'))]"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,89 +1,31 @@
|
||||||
# Create a SQL Server 2014 Always On Availability Group with PowerShell DSC Extension
|
# Create a SQL Server 2014 Stand alone with PowerShell DSC Extension
|
||||||
|
|
||||||
This template will create a SQL Server 2014 Always On Availability Group using the PowerShell DSC Extension it creates the following resources:
|
This template will create a SQL Server 2014 Always On Availability Group using the PowerShell DSC Extension it creates the following resources:
|
||||||
|
|
||||||
+ A Virtual Network
|
+ A Virtual Network
|
||||||
+ Three Storage Accounts
|
+ Two Storage Accounts
|
||||||
+ One external and one internal load balancer
|
+ One external load balancer
|
||||||
+ Two VMs configured as Domain Controllers for a new forest with a single domain
|
+ One VM configured as Domain Controller for a new forest with a single domain
|
||||||
+ Three VMs in a Windows Server Cluster, two VMs run SQL Server 2014 with an availability group and the third is a File Share Witness for the Cluster
|
+ One VM configured as SQL Server 2014 stand alone
|
||||||
+ Two Availability Sets one for the AD VMs, the other for the SQL and Witness VMs, the second Availability Set is configured with three Update Domains and three Fault Domains
|
|
||||||
|
|
||||||
The external load balancer creates an RDP NAT rule to allow connectivity to the first VM created, in order to access other VMs in the deployment this VM should be used as a jumpbox.
|
The external load balancer creates an RDP NAT rule to allow connectivity to the first VM created, in order to access other VMs in the deployment this VM should be used as a jumpbox.
|
||||||
|
|
||||||
A SQL Server always on listener is created using the internal load balancer.
|
|
||||||
|
|
||||||
# Known Issues
|
|
||||||
|
|
||||||
This template is entirely serial due to some issues between the platform agent and the DSC extension which cause problems when multiple VM and\or extension resources are deployed concurrently. This issue will be fixed as soon as possible.
|
|
||||||
|
|
||||||
## Notes
|
## Notes
|
||||||
|
|
||||||
+ The default settings for storage are to deploy using **premium storage**, the AD VMs use a P10 Disk and the SQL VMs use two P30 disks each, these sizes can be changed by changing the relevant variables. In addition there is a P10 Disk used for each VMs OS Disk.
|
|
||||||
|
|
||||||
+ In default settings for compute require that you have at least 19 cores of free quota to deploy.
|
|
||||||
|
|
||||||
+ The images used to create this deployment are
|
+ The images used to create this deployment are
|
||||||
+ AD - Latest Windows Server 2012 R2 Image
|
+ AD - Latest Windows Server 2012 R2 Image
|
||||||
+ SQL Server - Latest SQL Server 2014 on Windows Server 2012 R2 Image
|
+ SQL Server - Latest SQL Server 2014 on Windows Server 2012 R2 Image
|
||||||
+ Witness - Latest Windows Server 2012 R2 Image
|
|
||||||
|
|
||||||
+ The image configuration is defined in variables - details below - but the scripts that configure this deployment have only been tested with these versions and may not work on other images.
|
+ The image configuration is defined in variables - details below - but the scripts that configure this deployment have only been tested with these versions and may not work on other images.
|
||||||
|
|
||||||
|
|
||||||
Click the button below to deploy from the portal
|
|
||||||
|
|
||||||
<a href="https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Fraw.githubusercontent.com%2FAzure%2Fazure-quickstart-templates%2Fmaster%2Fsql-server-2014-alwayson-dsc%2Fazuredeploy.json" target="_blank">
|
|
||||||
<img src="http://azuredeploy.net/deploybutton.png"/>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
|
|
||||||
## Deploying from PowerShell
|
## Deploying from PowerShell
|
||||||
|
|
||||||
For details on how to install and configure Azure Powershell see [here].(https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/)
|
For details on how to install and configure Azure Powershell see [here].(https://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/)
|
||||||
|
|
||||||
Launch a PowerShell console
|
Launch a PowerShell console
|
||||||
|
|
||||||
Ensure that you are in Resource Manager Mode
|
|
||||||
|
|
||||||
```PowerShell
|
|
||||||
|
|
||||||
Switch-AzureMode AzureResourceManager
|
|
||||||
|
|
||||||
```
|
|
||||||
Change working folder to the folder containing this template
|
Change working folder to the folder containing this template
|
||||||
|
|
||||||
```PowerShell
|
```PowerShell
|
||||||
|
|
||||||
New-AzureResourceGroup -Name "<new resourcegroup name>" -Location "<new resourcegroup location>" -TemplateParameterFile .\azuredeploy-parameters.json -TemplateFile .\azuredeploy.json
|
New-AzurermResourceGroupDeployment -Name "<new resourcegroup name>" -Location "<new resourcegroup location>" -TemplateParameterFile .\azuredeploy.azurestack.parameters.json -TemplateFile .\azuredeploy.json
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
You will be prompted for the following parameters
|
|
||||||
|
|
||||||
+ **newStorageAccountNamePrefix:** - specify the prefix for the new storage account names
|
|
||||||
+ **locationFromTemplate:** - specify a valid location for the deployment
|
|
||||||
+ **adminPassword:** - the administrator password for the VMs and Domain
|
|
||||||
+ **sqlServerServiceAccountPassword:** the password for the account that SQL Server will run as
|
|
||||||
+ **dnsPrefix:** the DNS prefix for the public IP address used for RDP
|
|
||||||
|
|
||||||
## Notable Variables
|
|
||||||
|
|
||||||
|Name|Description|
|
|
||||||
|:---|:---------------------|
|
|
||||||
|virtualNetworkName|Name of the Virtual Network|
|
|
||||||
|adPDCVMName|The name of the Primary Domain Controller|
|
|
||||||
|adBDCVMName|The name of the Backup\Second Domain Controller|
|
|
||||||
|sqlVMName|The prefix for the SQL VM Names|
|
|
||||||
|sqlwVMName|The name of the File Share Witness|
|
|
||||||
|spwebVMName|The Prefix of the SharePoint Web Server VMs|
|
|
||||||
|rdpPort|The public RDP port for first VM|
|
|
||||||
|windowsImagePublisher|The name of the pulisher of the AD and Witness Image|
|
|
||||||
|windowsImageOffer|The Offer Name for the Image used by AD and Witness VMs|
|
|
||||||
|windowsImageSKU|The Image SKU for the AD and Witness Image|
|
|
||||||
|sqlImagePublisher|The name of the pulisher of the SQL Image|
|
|
||||||
|sqlImageOffer|The Offer Name for the Image used by SQL|
|
|
||||||
|sqlImageSKU|The Image SKU for the SQL Image|
|
|
||||||
|windowsDiskSize|The size of the VHD allocated for AD and Witness VMs Data Disk|
|
|
||||||
|sqlDiskSize|The size of the VHD allocated for SQL VMs Data and Log Disks|
|
|
||||||
|domainName|The name of the new AD Domain created|
|
|
||||||
|
|
Двоичные данные
sql-2014-non-ha/deploySqlStandalone.ps1.zip
Двоичные данные
sql-2014-non-ha/deploySqlStandalone.ps1.zip
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче