106k views
1 vote
How do you connect to a VM from the public internet using PowerShell?

a) Connect-AzVMInternet
b) Open-AzVMConnection
c) AzureVM-Connect
d) None of the above

1 Answer

3 votes

Final answer:

None of the options listed are correct for connecting to a VM from the public internet using PowerShell. Instead, steps like assigning a public IP and updating NSG rules are necessary, followed by using cmdlets such as Enter-AzVM for establishing a remote session.

Step-by-step explanation:

To connect to a Virtual Machine (VM) from the public internet using PowerShell, you would typically use a cmdlet provided by the Azure PowerShell module. However, none of the options a) Connect-AzVMInternet, b) Open-AzVMConnection, or c) AzureVM-Connect are actual PowerShell cmdlets that would allow you to connect to a VM on Azure. The correct way to connect to an Azure VM from the public internet involves several steps:

  • Establishing a public IP for the VM.
  • Ensuring that network security group (NSG) rules allow for remote access.
  • Using the correct PowerShell cmdlet like Enter-AzVM, which facilitates a remote session over PowerShell Remoting (WinRM).

Note that for security reasons, directly accessing a VM over the internet may not be advisable, and a VPN or ExpressRoute is often recommended for secure and reliable connectivity.

User Noah Wetjen
by
8.5k points