- Windows 10 Fall Creators Update installation and features - Thu, Nov 2 2017
- Install Microsoft SQL Server on Ubuntu Linux - Thu, Jan 5 2017
- Use PowerShell with Google Cloud Platform - Thu, Dec 8 2016
This release falls in line with recent PowerShell developments, such as running bash commands in PowerShell. Last month, PowerShell celebrated its 10-year anniversary; if you missed it, take a look at the PowerShell “Then and Now” keynote address here with J. Snover, K. Hansen, and K. Banston. The video expresses PowerShell’s goals from the beginning of its implementation, utilizing and building upon the best UNIX ideas, such as wildcards, modules, -confirm, and output. I believe this poignant quote captures the essence of PowerShell’s abilities is:
… What PowerShell does so wonderfully is glues together this completely messy disjointed world and tries to bring it to this object-oriented-appearing approach.
I believe that bringing together different technologies in PowerShell is a worthwhile ambition and commend the investment Microsoft continues to place in PowerShell. It’s nice to see a technology that puts users and admins first, making our job more fun and allowing us to get the job done and go home.
Google Cloud SDK Setup ^
The Google Cloud SDK has no prerequisites other than Windows 7 SP1 or Windows 10 with PowerShell v5 installed. You will want to have an existing Google Cloud Platform account and have a running instance so you can establish a connection to the GCP. In this setup guide, we’ll use an existing SQL instance for testing, which we set up and demonstrated in our two previous GCP articles here.
To get the SDK setup started, first visit Cloud Tools for PowerShell and click on the button labeled “Get Cloud SDK for Windows.” On the following page, click on the Windows Cloud SDK installer. After the download completes, you’ll have a file named GoogleCloudSDKInstaller.exe. Double-click on the file and the installation wizard will start:
The space required will be about 90MB. Click on the Show details button during the installation to get an idea of the commands that will be available:
Click Next to finish the installation and make sure to check the box labeled “Run ‘gcloud init’ to configure the Cloud SDK,” and then click Finish.
Immediately a command prompt will open and run a script that welcomes you, does a network connection test, and asks to log in (Y/n)?
Hit Y and then Enter. Immediately your default web browser will launch and ask you to choose a Google account to log into; the command prompt will also display the URL, which you can copy if necessary, that launches:
After logging into your Google Cloud Platform account, accept the following permissions by clicking the Allow button:
The website and our command prompt will confirm we’ve authenticated. In the command prompt dialog, we select the project we want to use , which is the SQL Instance that we set up in our previous Google SQL Instance articles.
Next is displayed some setup, version, and command information, and we arrive at the command prompt C:\Program Files (x86)\Google\Cloud SDK>. However, we want to switch gears, leave open the original command prompt, and open our new Cloud Tools for PowerShell executable that we can find in the Windows Start Menu application search box; when we search for “PowerShell.”
Issuing commands with Cloud Tools for PowerShell ^
To see the account we’re using and the project we’re in, run the command:
gcloud config list
To see the properties of the SDK as well as version numbers and system paths, run the command:
To confirm we have new cmdlets in PowerShell, we can run the command:
Because we have an SQL Instance already running, we want to see the commands available to us to manage our Google Cloud Platform SQL Instance.
To see a list of our groups and commands, issue the command:
One command group we find is ‘sql’, so to view commands available to use inside that group, we issue the command:
gcloud sql –help
Building upon our results, we issue the command:
gcloud sql instances –help
Gcloud SQL Instances help
We now have the ability to use PowerShell to perform or script any number of actions including create, restart, backup, import, and export data, as well as instances within the Google Cloud Platform—pretty cool!
Subscribe to 4sysops newsletter!
As you can see, the setup of the Google Cloud Tools SDK is actually pretty simple, and that the new cmdlet provides us a very powerful interface into the Google Cloud Platform. With the GCP now just another cmdlet in PowerShell, another messy, disjointed cloud technology has been pulled into a coherent, connected, single interface.