You are setting up a Windows VM on Compute Engine and want to make sure you can log in to the VM via RDP.
What should you do?
Click on the arrows to vote for the correct answer
A. B. C. D.D.
To log in to a Windows virtual machine (VM) on Google Cloud Platform (GCP) Compute Engine via Remote Desktop Protocol (RDP), you need to follow the steps below:
Create a Windows VM on Compute Engine: You can create a Windows VM on Compute Engine using the GCP Console, the gcloud command-line tool, or the Compute Engine API. Ensure that you have the necessary permissions to create VMs.
Allow RDP traffic: By default, Compute Engine VMs do not allow RDP traffic. You need to create a firewall rule to allow RDP traffic to the VM. You can create the rule using the GCP Console or the gcloud command-line tool.
For example, to create a firewall rule that allows RDP traffic from any IP address to the VM, run the following command:
gcloud compute firewall-rules create allow-rdp --allow tcp:3389 --description "Allow RDP traffic" --direction INGRESS --target-tags=rdp
The command creates a firewall rule named "allow-rdp" that allows TCP traffic on port 3389 and applies to VMs with the tag "rdp."
Option A: Use your Google Account credentials: If you used your Google Account to create the VM, you can use those credentials to log in to the VM. However, it is recommended that you use a separate user account for security reasons.
Option B: Use gcloud compute reset-windows-password: If you do not have the login credentials for the VM, you can use the gcloud compute reset-windows-password command to reset the password. The command generates a new password and displays it in the command output. You can then use the new password to log in to the VM.
For example, to reset the password for a VM named "my-vm" in the "us-central1" zone, run the following command:
gcloud compute reset-windows-password my-vm --zone us-central1
The command resets the password for the default user account and displays the new password in the command output.
For example, to create a VM named "my-vm" with a password of "MyPassword123" in the "us-central1" zone, you can use the following gcloud command:
gcloud compute instances create my-vm --image-family=windows-server-2019-core --image-project=windows-cloud --metadata windows-password=MyPassword123 --zone us-central1
After you have retrieved the login credentials for the VM, you can use an RDP client to connect to the VM. The RDP client is built into Windows and is also available for other operating systems. You need to specify the IP address of the VM, the username, and the password to log in to the VM.
Note that after you log in to the VM, you should follow the security best practices for Windows VMs, such as applying security updates, installing anti-virus software, and configuring firewall rules.