Powershell was introduced in November 2006 to replace the old “command prompt” and assist users with “task automation and configuration management,” on multiple platforms – Windows, macOs, or Linux (Parchisanu). The newest version, Powershell 7, was released on March 4, 2020. To translate for those of us unfamiliar with tech jargon like “task automation and configuration management,” Powershell is a program that allows the user to easily program their computer to complete simple administrative tasks or manage a network.
What is Azure
Azure is a group of cloud services released by Microsoft in October 2008, and its most recent version was released this month on May 4, 2020. Just as important, Microsoft introduced Azure Powershell AZ in May 2019 in order to make Azure compatible with Powershell on all platforms, rather than Windows only. By combining the two, Microsoft has increased the flexibility and ease of computer programming and administration for those who work with multiple platforms. This is especially handy if you need to set up, modify, or remove a network security group (NSG).
Setting Up an NSG
To manage your NSGs using Azure PowershellAZ you will need to have an Azure account. Don’t worry though, if you don’t have a subscription already, you can get one for free at Azure.Microsoft.com. Just be sure that the account you are using has been assigned a network contributor or other custom role with permissions set to allow it to make changes. Microsoft Azure’s website provides the following simple instructions for setting up an NSG:
How you begin depends on how you are accessing Azure.
- Portal users: Sign in to the Azure portal with your Azure account.
- PowerShell users: Either run the commands in the Azure Cloud Shell, or run PowerShell from your computer. In the ‘Azure Cloud Shell’ browser tab, find the ‘Select Environment’ dropdown list, then pick ‘PowerShell’ if it isn’t already selected.
- If you’re running PowerShell locally, use Azure PowerShell module version 1.0.0 or later. Run ‘Get-Module -ListAvailable Az.Network’ to find the installed version. If you need to upgrade, you will need to install the Azure PowerShell module first. Run ‘Connect-AzAccount’ to create a connection with Azure.
- Azure Command-line interface (CLI) users: Either run the commands in the Azure Cloud Shell, or run the CLI from your computer. Use Azure CLI version 2.0.28 or later if you’re running the Azure CLI locally. Run “AZ –version” to find the installed version. If you need to, install or upgrade the most recent version. Run “AZ login” to create a connection with Azure.
Choose “Create a Resource” from either the Azure portal or “Home” page. Next, choose “Networking”, and then “Network Security Group.” On the “Create Network Security Group” page, select the “Basics” tab and then choose your values for the following:
- Subscription: Choose the subscription you prefer.
- Resource Group: Create a new or choose an established resource group.
- Name: Enter a unique text string in a resource group.
- Region: Choose your desired location.
Finally, choose “Review & Create.” When the “Validation Passed” message pops up, choose “Create” (Azure). You’re done!
Now that you’ve set up your NSG you can use Powershell and Azure to monitor your NSGs, use its diagnostic tools to troubleshoot errors, and set up and manage security rules. Microsoft even has a handy series of articles available on their website to help you get the most out of Powershell and Azure’s cloud platform. With these two programs you can move past the old command prompt, and into modern day computer administration.