$passwordfile = "~\azuresecret.txt" $password = Get-Content $passwordfile|ConvertTo-SecureString -key (1..16) #$password = Get-Content $passwordfile|ConvertTo-SecureString $username = "YOURACCOUNTNAME@DOMAINNAME" $cred = New-Object System.Management.Automation.PSCredential($username , $password) Connect-AzAccount -Credential $cred