Creating script in PowerShell instead of using Azure Cli

Welcome Forums General PowerShell Q&A Creating script in PowerShell instead of using Azure Cli

Viewing 1 reply thread
  • Author
    Posts
    • #181977
      Participant
      Topics: 26
      Replies: 59
      Points: 97
      Rank: Member

      I have been able to fine Azure CLI AZ commands to use extensions to change admin password on RHEL 7 servers.
      But I would really prefer to do this with the new PowerShell AZ modules.

              az vm user update –resource-group $($vm.ResourceGroupName) –name $($vm.Name) –username $UserName –password $NewPassword
                  if ( $? ) {
                      Write-Verbose -Message "Password reset for $($vm.Name). Restarting ssh!"
                      Sleep -Seconds 3
                      az vm user reset-ssh –name $($vm.Name) –resource-group $($vm.ResourceGroupName)
                  }
      

      Anyone know the specifics of how to do this in Powershell without using cli2?

    • #183075
      Participant
      Topics: 0
      Replies: 21
      Points: 133
      Helping Hand
      Rank: Participant

      Looks like you might be able to change the admin user password using Set-AzVMOperatingSystem -Credential. Not sure how this affects SSH credentials.

      See Set-AzVMOperatingSystem

Viewing 1 reply thread
  • You must be logged in to reply to this topic.