If you are new to Google Cloud Platform, you may be wondering how to connect to your brand-new VM instance that you just created. By default, Windows instances created at GCP require a new password to be generated — and that helps in the security side of things where an administrator does not use the same password every single time on all instances being created.
The first step after creating your VM instance is to list all existent instances on any given project that you may have. Let’s get started!
Click on Navigation Menu, Compute Engine, and then on VM Instances. A list of all VM instances in the current project will be listed. In the example below, we have a single VM.
To manage the password and to connect to the VM instance, click on RDP and a menu with several options will be displayed, as depicted in the image below. Click on Set Windows password.
The first step is to define the username. If the username does not exist, it will be created automatically as part of the process. In our example, we will use our most famous administrator batman. After defining the username click on Set.
The second page of this small wizard is the password being generated for the new user that we have just defined in the previous step. Save that information over and click on Close.
What happens at the Windows level, if we check the Local Users and Groups using Computer Management, we will see our new user who, by the way, is the only one enable being listed in the accounts area. The new user is automatically added as an administrator of that VM instance.
Connecting to the Windows instance VM
Now that we have a username and password assigned to our new Windows instance VM, we have a couple of ways to connect to it. The first one is using regular RDP connection, where we click on the arrow beside RDP and then we select Download the RDP file.
The file contains all the required information to connect to the selected VM instance. We just need to provide the username and password that we defined in the previous section.
Since we are using GCP, we may as well use their Google Chrome browser. It has an extension you can install that supports the RDP straight from the GCP console.
During the first connection, the following dialogue box will be displayed. Click on Install Chrome RDP Extension, we will be redirected to the Chrome web store.
If you missed this dialogue box don’t worry about it, you can always go to Google Apps in your browser (type chrome://apps/) and there is a Web Store icon in the bottom right corner. Click on it and type RDP extension and install it from there.
In the Chrome web store, click on Add to Chrome, and on the new dialogue box, just confirm by hitting Add app.
If we visit chrome://apps again, we will see a new icon there, which we can use to connect RDP to any server, but the goal of this article is to show the integration between GCP Console and this new app.
If we go back to the GCP console and click on RDP, the new Chrome RDP for Google Cloud Platform will be open automatically, and the connection with that specific server will be underway. We just need to provide the authentication details (domain, name and password).
Using Cloud Shell to define/reset password
Another option is using Google Cloud Shell. We can access this console using the icon located in the upper left corner of the GCP console, and from there type in the commands to manage the password. The syntax is this one: we provide the project name, VM instance name, and the zone.
gcloud compute –project “<project-name>” reset-windows-password “<server-name>” –zone “<zone-name>”
There is a lazy way of having all the VM instances of your project being listed. Click on the RDP arrow located in Connect column, and then click on View gcloud command to reset password. In the new window, we can copy the content and perform the necessary choices or just click on Run in Cloud Shell. What I personally like about this one is that the command does not run automatically but it is written in the console. If you actually want to execute it you must hit enter, which gives you room to perform any last-minute changes in case you need it.
Be aware that the Google Cloud Shell to change the password is in beta, and there are no parameters to use a different username than the one that you are logged on the GCP console. In the image below, we run the command and it asks to reset the password for the user Anderson and after confirming, the new password is displayed in the console.
As expected, the result at the Windows local account side is a new administrator being listed, as depicted in the image below.
One more point to cover: You may be wondering how to check the firewall rules related to the RDP protocol in the new VM instance — by default, RDP and SSH are always open. You can always check it out by clicking on the … at the VM instance level, and then selecting View network details.
Featured image: Shutterstock