Hello,
I’m trying to set up a scale set with 3 VMs through Powershell.
I’m executing this script: New-AzureRmResourceGroupDeployment -ResourceGroupName $rgName -TemplateFile ‘C:\Users\victor\Downloads\Ny\Ny\azuredeploy.json’ -TemplateParameterFile ‘C:\Users\victor\Downloads\Ny\Ny\azuredeploy.parameters.json’ -Verbose # -Mode Complete
And the Json files are listed below:
I get the error message “Unable to update password”
Everything goes fine until the VMs are abot to join the domain. I don’t get it, i even tried to set up a VM manually and executed a local script telling i to join the domain and it worked flawless, so i don’t know what the difference should be going through scaleset. Please help
Azuredeploy.json;
{
“$schema”: “https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#”,
“contentVersion”: “1.0.0.0”,
“parameters”: {
“existingVNETName”: {
“type”: “string”,
“metadata”: {
“description”: “Existing VNET that contains the domain controller”
}
},
“existingSubnetName”: {
“type”: “string”,
“metadata”: {
“description”: “Existing subnet that contains the domain controller”
}
},
“dnsLabelPrefix”: {
“type”: “string”,
“metadata”: {
“description”: “Unique public DNS prefix for the deployment. The fqdn will look something like ‘.westus.cloudapp.azure.com’. Up to 62 chars, digits or dashes, lowercase, should start with a letter: must conform to ‘[1][a-z0-9-]{1,61}[a-z0-9]$’.”
}
},
“vmSize”: {
“type”: “string”,
“defaultValue”: “Standard_A2”,
“metadata”: {
“description”: “The size of the virtual machines”
}
},
“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.”
}
},
“domainToJoin”: {
“type”: “string”,
“metadata”: {
“description”: “The FQDN of the AD domain”
}
},
“domainUsername”: {
“type”: “string”,
“metadata”: {
“description”: “Username of the account on the domain”
}
},
“domainPassword”: {
“type”: “securestring”,
“metadata”: {
“description”: “Password of the account on the domain”
}
},
“ouPath”: {
“type”: “string”,
“defaultValue”: “”,
“metadata”: {
“description”: “Specifies an organizational unit (OU) for the domain account. Enter the full distinguished name of the OU in quotation marks. Example: 'OU=testOU; DC=domain; DC=Domain; DC=com”
}
},
“domainJoinOptions”: {
“type”: “int”,
“defaultValue”: 3,
“metadata”: {
“description”: “Set of bit flags that define the join options. Default value of 3 is a combination of NETSETUP_JOIN_DOMAIN (0x00000001) & NETSETUP_ACCT_CREATE (0x00000002) i.e. will join the domain and create the account on the domain. For more information see https://msdn.microsoft.com/en-us/library/aa392154(v=vs.85).aspx”
}
},
“vmAdminUsername”: {
“type”: “string”,
“metadata”: {
“description”: “The name of the administrator of the new VM and the domain. Exclusion list: ‘admin’,'administrator”
}
},
“vmAdminPassword”: {
“type”: “securestring”,
“metadata”: {
“description”: “The password for the administrator account of the new VM and the domain”
}
},
“instanceCount”: {
“type”: “int”,
“metadata”: {
“description”: “Number of VM instances (100 or less).”
},
“maxValue”: 100
}
},
“variables”: {
“otherRG”: “RDS-MASTER”,
“storageAccountName”: “[concat(uniquestring(resourceGroup().id, deployment().name))]”,
“imagePublisher”: “MicrosoftWindowsServer”,
“imageOffer”: “WindowsServer”,
“windowsOSVersion”: “2012-R2-Datacenter”,
“apiVersion”: “2015-06-15”,
“nicName”: “[concat(parameters(‘dnsLabelPrefix’),‘Nic’)]”,
“publicIPName”: “[concat(parameters(‘dnsLabelPrefix’),‘Pip’)]”,
“vnetID”: “[resourceId(variables(‘otherRG’), ‘Microsoft.Network/virtualNetworks’, parameters(‘existingVNETName’))]”,
“subnetId”: “[concat(variables(‘vnetID’),‘/subnets/’, parameters(‘existingSubnetName’))]”,
“ipConfigName”: “[concat(parameters(‘dnsLabelPrefix’), ‘ipconfig’)]”,
“wadlogs”: " ",
“wadperfcounters1”: “”,
“wadperfcounters2”: “”,
“wadcfgxstart”: “[concat(variables(‘wadlogs’),variables(‘wadperfcounters1’),variables(‘wadperfcounters2’),‘’)]”,
“diagnosticsStorageAccountName”: “[concat(uniquestring(resourceGroup().id, deployment().name),‘diag’)]”,
“diagnosticsStorageAccountResourceGroup”: “[resourceGroup().name]”,
“accountid”: “[concat(‘/subscriptions/’,subscription().subscriptionId,‘/resourceGroups/’,variables(‘diagnosticsStorageAccountResourceGroup’),‘/providers/’,‘Microsoft.Storage/storageAccounts/’, variables(‘diagnosticsStorageAccountName’))]”,
“osType”: {
“publisher”: “MicrosoftWindowsServer”,
“offer”: “WindowsServer”,
“sku”: “[parameters(‘windowsOSVersion’)]”,
“version”: “latest”
},
“imageReference”: “[variables(‘osType’)]”,
“computeApiVersion”: “2016-03-30”,
“networkApiVersion”: “2016-03-30”,
“storageApiVersion”: “2015-06-15”,
“insightsApiVersion”: “2015-04-01”
},
“resources”: [
{
“apiVersion”: “[variables(‘apiVersion’)]”,
“type”: “Microsoft.Storage/storageAccounts”,
“name”: “[variables(‘storageAccountName’)]”,
“location”: “[resourceGroup().location]”,
“properties”: {
“accountType”: “Standard_LRS”
}
},
{
“apiVersion”: “[variables(‘apiVersion’)]”,
“type”: “Microsoft.Storage/storageAccounts”,
“name”: “[variables(‘diagnosticsStorageAccountName’)]”,
“location”: “[resourceGroup().location]”,
“properties”: {
“accountType”: “Standard_LRS”
}
},
{
“apiVersion”: “[variables(‘apiVersion’)]”,
“type”: “Microsoft.Network/networkInterfaces”,
“name”: “[variables(‘nicName’)]”,
“location”: “[resourceGroup().location]”,
“properties”: {
“ipConfigurations”: [
{
“name”: “ipconfig”,
“properties”: {
“privateIPAllocationMethod”: “Dynamic”,
“subnet”: {
“id”: “[variables(‘subnetId’)]”
}
}
}
]
}
},
{
“type”: “Microsoft.Compute/virtualMachineScaleSets”,
“name”: “[parameters(‘dnsLabelPrefix’)]”,
“location”: “[resourceGroup().location]”,
“apiVersion”: “[variables(‘computeApiVersion’)]”,
“dependsOn”: [
“[resourceId(‘Microsoft.Storage/storageAccounts’,variables(‘storageAccountName’))]”,
“[resourceId(‘Microsoft.Network/networkInterfaces’, variables(‘nicName’))]”
],
“sku”: {
“name”: “[parameters(‘vmSize’)]”,
“tier”: “Standard”,
“capacity”: “[parameters(‘instanceCount’)]”
},
“properties”: {
“overprovision”: “true”,
“upgradePolicy”: {
“mode”: “Manual”
},
“virtualMachineProfile”: {
“storageProfile”: {
“osDisk”: {
“vhdContainers”: [
“[concat(‘http://’,variables(‘storageAccountName’),‘.blob.core.windows.net/vhds/’)]”
],
“name”: “osDisk”,
“caching”: “ReadOnly”,
“createOption”: “FromImage”
},
“imageReference”: “[variables(‘imageReference’)]”
},
“osProfile”: {
“computerNamePrefix”: “[parameters(‘dnsLabelPrefix’)]”,
“adminUsername”: “[parameters(‘vmAdminUsername’)]”,
“adminPassword”: “[parameters(‘vmAdminPassword’)]”
},
“networkProfile”: {
“networkInterfaceConfigurations”: [
{
“name”: “[variables(‘nicName’)]”,
“properties”: {
“primary”: “true”,
“ipConfigurations”: [
{
“name”: “[variables(‘ipConfigName’)]”,
“properties”: {
“subnet”: {
“id”: “[concat(‘/subscriptions/’, subscription().subscriptionId,‘/resourceGroups/’, variables(‘otherRG’), ‘/providers/Microsoft.Network/virtualNetworks/’, parameters(‘existingVNETName’), ‘/subnets/’, parameters(‘existingSubnetName’))]”
}
}
}
]
}
}
]
},
“extensionProfile”: {
“extensions”: [
{
“name”: “Microsoft.Insights.VMDiagnosticsSettings”,
“properties”: {
“publisher”: “Microsoft.Azure.Diagnostics”,
“type”: “IaaSDiagnostics”,
“typeHandlerVersion”: “1.5”,
“autoUpgradeMinorVersion”: true,
“settings”: {
“xmlCfg”: “[base64(concat(variables(‘wadcfgxstart’),variables(‘wadmetricsresourceid’),variables(‘wadcfgxend’)))]”,
“storageAccount”: “[variables(‘diagnosticsStorageAccountName’)]”
},
“protectedSettings”: {
“storageAccountName”: “[variables(‘diagnosticsStorageAccountName’)]”,
“storageAccountKey”: “[listkeys(variables(‘accountid’), variables(‘storageApiVersion’)).key1]”,
“storageAccountEndPoint”: “https://core.windows.net”
}
}
},
{
“name”: “Microsoft.Powershell.DSC”,
“properties”: {
“publisher”: “Microsoft.Powershell”,
“type”: “DSC”,
“typeHandlerVersion”: “2.19”,
“autoUpgradeMinorVersion”: true,
“settings”: {
“ModulesUrl”: “https://educait-my.sharepoint.com/personal/daniel_wahlgren_educait_se/_layouts/15/guestaccess.aspx?guestaccesstoken=K4%2FRPux93QI2R5C%2FD59XTJ5ttoY2teJpvEGNnxxJKbY%3D&docid=0bdb011f137464614b4dbafb6cb64ab87”,
“SasToken”: “”,
“ConfigurationFunction”: “Configuration.ps1\DomainJoin”,
“Properties”: [
{
“Name”: “adminCreds”,
“Value”: {
“UserName”: “[parameters(‘domainUsername’)]”,
“Password”: “PrivateSettingsRef:domainPasswordPrivate”
},
“TypeName”: “System.Management.Automation.PSCredential”
},
{
“Name”: “domainName”,
“Value”: “[parameters(‘domainToJoin’)]”,
“TypeName”: “System.String”
},
{
“Name”: “domainOuPath”,
“Value”: “[parameters(‘ouPath’)]”,
“TypeName”: “System.String”
}
]
},
“protectedSettings”: {
“Items”: {
“domainPasswordPrivate”: “[parameters(‘domainPassword’)]”
}
}
}
}
]
}
}
}
},
{
“type”: “Microsoft.Insights/autoscaleSettings”,
“apiVersion”: “[variables(‘insightsApiVersion’)]”,
“name”: “autoscalewad”,
“location”: “[resourceGroup().location]”,
“dependsOn”: [
“[concat(‘Microsoft.Compute/virtualMachineScaleSets/’, parameters(‘dnsLabelPrefix’))]”
],
“properties”: {
“name”: “autoscalewad”,
“targetResourceUri”: “[concat(‘/subscriptions/’,subscription().subscriptionId, ‘/resourceGroups/’, resourceGroup().name, ‘/providers/Microsoft.Compute/virtualMachineScaleSets/’, parameters(‘dnsLabelPrefix’))]”,
“enabled”: true,
“profiles”: [
{
“name”: “Profile1”,
“capacity”: {
“minimum”: “1”,
“maximum”: “10”,
“default”: “1”
},
“rules”: [
{
“metricTrigger”: {
“metricName”: “\Processor(_Total)\% Processor Time”,
“metricNamespace”: “”,
“metricResourceUri”: “[concat(‘/subscriptions/’,subscription().subscriptionId, ‘/resourceGroups/’, resourceGroup().name, ‘/providers/Microsoft.Compute/virtualMachineScaleSets/’, parameters(‘dnsLabelPrefix’))]”,
“timeGrain”: “PT1M”,
“statistic”: “Average”,
“timeWindow”: “PT5M”,
“timeAggregation”: “Average”,
“operator”: “GreaterThan”,
“threshold”: 50.0
},
“scaleAction”: {
“direction”: “Increase”,
“type”: “ChangeCount”,
“value”: “1”,
“cooldown”: “PT5M”
}
},
{
“metricTrigger”: {
“metricName”: “\Processor(_Total)\% Processor Time”,
“metricNamespace”: “”,
“metricResourceUri”: “[concat(‘/subscriptions/’,subscription().subscriptionId, ‘/resourceGroups/’, resourceGroup().name, ‘/providers/Microsoft.Compute/virtualMachineScaleSets/’, parameters(‘dnsLabelPrefix’))]”,
“timeGrain”: “PT1M”,
“statistic”: “Average”,
“timeWindow”: “PT5M”,
“timeAggregation”: “Average”,
“operator”: “LessThan”,
“threshold”: 30.0
},
“scaleAction”: {
“direction”: “Decrease”,
“type”: “ChangeCount”,
“value”: “1”,
“cooldown”: “PT5M”
}
}
]
}
]
}
}
]
}
Azuredeploy.parameters.json;
{
“$schema”: “http://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#”,
“contentVersion”: “1.0.0.0”,
“parameters”: {
“existingVNETName”: {
“value”: “RDS-MASTER”
},
“existingSubnetName”: {
“value”: “RDS”
},
“vmSize”: {
“value”: “Standard_A1”
},
“ouPath”: {
“value”: “OU=RDSH,DC=contoso,DC=local”
},
“windowsOSVersion”: {
“value”: “2012-R2-Datacenter”
},
“domainToJoin”: {
“value”: “contoso.local”
},
“domainUsername”: {
“value”: “windows”
},
“domainPassword”: {
“value”: “"
},
“domainJoinOptions”: {
“value”: 3
},
“vmAdminUsername”: {
“value”: “windows”
},
“vmAdminPassword”: {
“value”: "”
},
“dnsLabelPrefix”: {
“value”: “RDSH”
},
“instanceCount”: {
“value”: 2
}
}
}
-
a-z ↩︎