I created a Windows virtual machine on Windows Azure using winrm over SSL.
But I can not connect it using powershell script.
When I run the following:
Enter-PSSession -ConnectionUri https:
-Credential "hostname/username"
-SessionOption (New-PSSessionOption -SkipCACheck -SkipCNCheck)
I get a request with a password, and after entering it, I can connect.
But when I try to automate it, it always comes back with "Access denied"
$securePassword = ConvertTo-SecureString -AsPlainText -Force "password"
$cred = New-Object System.Management.Automation.PSCredential "hostname/username", $securePassword
Enter-PSSession -ConnectionUri https:
Any ideas?
Edit
The full error looks like this:
Enter-PSSession: The connection to the remote myniceaspp.cloudapp.net server failed with the following error message: access denied. For more information, see the help topic about_Remote_Troubleshooting.
: 1 char: 1
+ Enter-PSSession -ConnectionUri https://myniceaspp.cloudapp...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo: InvalidArgument: (https://myniceaspp... udapp.net:5986/:Uri) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId: CreateRemoteRunspaceFailed