Following is a guideline on setting up PowerShell remoting in an azure VM so that another azure VM in same Virtual Network, is able to execute PowerShell commands on the remoting enabled virtual machine. This will allow to setup as a test farm to run with visual studio team service or with TFS (will be discussed in a future post).
Set the assignment to static. This will make the internal IP unchanged, when the machine is restarted.
Doing it with PowerShell explained here.
2. Execute the command to enable PowerShell remoting in the virtual machine. (run PS as administrator)
This will throw an error which is bit of misleading and not providing enough information. If your virtual machine is not in a domain this might occur. More details discussed in below link.
This can be fixed by running the command with –SkipNetworkProfileCheck switch.
3. From another virtual machine in the same virtual network in azure, you should be able to enter into a remote PowerShell session, and execute commands in the remote machine. But again this fails with another error.
Enter-PSSession –ComputerName <remotemachinenameorip> –Credential <remotemachineadminuser>
Connecting to remote server do-tf-tc02 failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. You can get more information about that by running the following command: winrm help config. For more information, see the about_Remote_Troubleshooting Help
4. To fix this issue, add remote machine name to trusted hosts in the client of remote PS.
Set-Item -Path WSMan:\localhost\Client\TrustedHosts –Value <remotemachinenameorip>