title: is there a way of automating $credential = Get-Credential when running Set-AzVMADDomainExtension
body: <p>I need to automate domain join in a pipleine for Azure vm , Im using this code, however I dont want the user to enter the credential during runtime, how can i use a saved credential?</p>
  <pre><code>$DomainName = &quot;abc.com&quot;
  $VMName = &quot;VMNAME01&quot;
  $credential = Get-Credential
  $ResourceGroupName = &quot;RG01&quot; 
  Set-AzVMADDomainExtension -DomainName $DomainName -VMName $VMName -Credential $credential -ResourceGroupName $ResourceGroupName -JoinOption 0x00000001 -Restart -Verbose
  </code></pre>