次の方法で共有


How to Reset Password for VMSS (Scale Set) Instances

This blog is being migrated to www.solveazure.com and will be decommissioned once the content has been moved. ETA 2/28/2019

Please use www.solveazure.com for updated and continuous content.  

Symptom:

Unable to RDP to a Virtual Machine Scale Set Instance (VMSS) due to an incorrect password

Resolution:

  1. If Azure PowerShell is not installed, install it from https://azure.microsoft.com/en-us/downloads/

  2. Open up PowerShell ISE as an Administrator

  3. Paste the following script into the Window modifying each of the red portions accordingly:

    Login-AzureRmAccount
    Get-AzureRmSubscription -SubscriptionId 'SUBSCRIPTIONID' | Select-AzureRmSubscription

    $vmssName = 'SCALESETNAME'
    $vmssResourceGroup = 'SCALESETRESOURCEGROUP'
    $publicConfig = @{'UserName' = 'USERNAME'}
    $privateConfig = @{'Password' = 'NEWPASSWORD'}
    $extName = 'VMAccessAgent'
    $publisher = 'Microsoft.Compute'
    $vmss = Get-AzureRmVmss -ResourceGroupName $vmssResourceGroup -VMScaleSetName $vmssName
    $vmss = Add-AzureRmVmssExtension -VirtualMachineScaleSet $vmss -Name $extName -Publisher $publisher -Setting $publicConfig -ProtectedSetting $privateConfig -Type $extName -TypeHandlerVersion '2.0' -AutoUpgradeMinorVersion $true

    Update-AzureRmVmss -ResourceGroupName $vmssResourceGroup -Name $vmssName -VirtualMachineScaleSet $vmss 

  4. Navigate to the Azure Portal and select the VM Scale Set

  5. Select Instances

  6. You should see that all the instances are not updated to the Latest Model
    1

  7. Check all the boxes of the instance you wish you update with the new username and password

  8. Select Upgrade
    2

  9. After a few mins (Depending on the number of instances you updated) you should see the Latest Model change to Yes
    3

  10. You can now login to the Scale Set VMs using the new Username and Password

Comments

  • Anonymous
    August 21, 2017
    It was great help to add local user in VM Set. thank you for sharing the PowerShell.
    • Anonymous
      August 22, 2017
      Thanks! Happy to hear it was able to help you out :)