DevOps Automation using PowerShell Scripts
DevOps Automation using PowerShell Scripts
Learn how to use PowerShell scripts to automate the deployment of VM resources in DevOps.
Google Compute Engine (GCE) is without a doubt one of the greatest and most extensively used public Infrastructure-as-a-Service (IaaS) platforms for building customisable virtual machines. GCE enables software developers to create and execute virtual machine instances on Google's actual hardware (infrastructure) for application development, testing, and deployment.
You must have successfully googled for a lot of resources and information on how to establish a VM instance on Google Cloud Platform (GCP). But it's all a labor - intensive and time-consuming task! Why invest time and effort on manual activities when you can just DevOps instead?
The inclusion of technology that executes tasks with far less human help to processes that promote feedback loops between operations and development teams so that continuous updates can be released to production apps faster is known as DevOps automation.
Every cloud workload and function may be automated using DevOps and automation, saving your firm many business hours, hundreds of dollars, and IT administration resources and efforts. There is no cloud management task that DevOps cannot automate, especially when you collaborate with us.
So, here's a step-by-step approach with PowerShell scripts for automating the creation of compute engine VM instances on the Google Cloud (gCloud) Platform:
Step 1: Install Google Cloud Module
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module GoogleCloud -Force
-----------------------------------------------------------------------------------------------------------------------
Step 2: Install Python
[Net.ServicePointManager]::SecurityProtocol =
[Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri “https://www.python.org/ftp/python/3.7.0/python-
3.7.0.exe” -OutFile “appdata/python-3.7.0.exe”
appdata/python-3.7.0.exe /quiet InstallAllUsers=0 PrependPath=1 Include_test=0
-----------------------------------------------------------------------------------------------------------------------
Step 3: Install SDK
$env:GCLOUD_SDK_INSTALLATION_NO_PROMPT = $true
Import-Module GoogleCloud -Force
$env:Path += “;AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin”
-----------------------------------------------------------------------------------------------------------------------
Step 4: Login Credentials
gcloud auth activate-service-account –key-
file=C:\Users\Administrator\Downloads\migration-dev-260106-97804e2bbc01.json
gcloud auth login #web browser
-----------------------------------------------------------------------------------------------------------------------
Step 5: API Enable Compute Instance for Project
gcloud projects list
gcloud config set project ps-vm-create
gcloud services list –available
gcloud services enable compute.googleapis.com
gcloud info
-----------------------------------------------------------------------------------------------------------------------
Step 6: Compute Instance Create
gcloud compute images list –project windows-cloud –no-standard-images
$disk = Get-GceImage “windows-cloud” -Family “windows-2012-r2”
$config = New-GceInstanceConfig tabexp `
-MachineType n1-standard-1 `
-DiskImage $disk
$config | Add-GceInstance -Project ps-vm-creategcloud compute reset-windows-password tabexp –quiet
And our automation is complete! How easy was that?
Togglr Cloud consists of a team of professional cloud consultants & have assisted various firms across India and the United Kingdom in automating manual cloud processes and eliminating major IT costs, courtesy to our extensive experience in Azure cloud migration services, DevOps consulting, and automation services
Note:
*If u have any queries please: Contact Us
*For free demo visit: Test and Buy




