Creating Scale Set with Azure RM

Welcome Forums General PowerShell Q&A Creating Scale Set with Azure RM

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 4 months ago.

  • Author
    Posts
  • #45948

    Participant
    Points: 0
    Rank: Member

    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 '^[a-z][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
    }
    }
    }

  • #45959

    Participant
    Points: 0
    Rank: Member

    If someone could delete the first post that would be awesome, i made a mistake 😀

    Here's the script in pre blocks.

    {
      "$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 '^[a-z][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"
                    }
                  }
                ]
              }
            ]
          }
        }
      ]
    }
    {
      "$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
        }
      }
    }
  • #46174

    Participant
    Points: 0
    Rank: Member

    I've been working with Victor on this, and yesterday he found the solution.
    The correct solution for this is to change the parameter domainUsername to contoso.local\\windows like so:

    {
      "$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": "contoso.local\\windows"
        },
        "domainPassword": {
          "value": "*************"
        },
        "domainJoinOptions": {
          "value": 3
        },
        "vmAdminUsername": {
          "value": "windows"
        },
        "vmAdminPassword": {
          "value": "************"
        },
        "dnsLabelPrefix": {
          "value": "RDSH" 
        },
    	"instanceCount": {
          "value": 2
        }
      }
    }

    Victor, for future reference it is probably easier to help if you also post the Configure.ps1 from the DSC.zip-file.
    Now we move on to the next 1000 steps to get this project to work properly!

The topic ‘Creating Scale Set with Azure RM’ is closed to new replies.