This post is the first in a series in which I will show how to create different resources in Microsoft Azure. Today I will show you how to create an essential component: a Resource Group.
An Azure resource group is a collection of Azure resources that are implemented as a unit and contains Azure resources such as a storage account, virtual networks, Virtual Machines, or a website.
This tutorial assumes that you already have a Microsoft Azure account set up.
Azure PowerShell Workaround
If you want to know how to install the PowerShell Azure module on your machine, check out this link.
The simplest way to get started is to sign in interactively at the command line.
1 2 3 | Login-AzureRmAccount |
This cmdlet will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. To perform this task, we will use the following commands:
1 2 3 4 | Get-AzureRmSubscription Select-AzureRmSubscription -Subscription "My Subscription" |
Once you set your default subscription, you are ready to create the resource group with New-AzureRmResourceGroup cmdlet.
To create a Resource Group with PowerShell, use the New-AzureRmResourceGroup cmdlet with the following syntax:
1 2 3 4 5 | New-AzureRmResourceGroup -Name <String> ` -Location <String> |
-Location Parameter
With the following cmdlet in PowerShell, we obtain the list of existing locations in Azure.
1 2 3 | Get-AzureRmLocation | Select-Object DisplayName, Location |
You can verify the task by running the Get-AzureRmResourceGroup cmdlet.
1 2 3 | Get-AzureRmResourceGroup |
Azure CLI Workaround
You can use it in your browser with Azure Cloud Shell or install it on your machine. If you want to know how to install the Azure CLI, check out this link.
The way to get started is to sign in interactively at the command line.
1 2 3 | az login |
This command will bring up a dialog box prompting you for your email address and password associated with your Azure account.
If you have more than one subscription associated with your mail account, you can choose the default subscription. to perform this task, we will use the following commands:
1 2 3 4 5 | az account list az account set --subscription "Subscription Name" |
To create a Resource Group with Azure CLI, use the following syntax:
1 2 3 | az group create --name RG-DEMOCLI --location westeurope |
–location Parameter
With the following command, we obtain the list of existing locations in Azure.
1 2 3 | az account list-locations |
As you can see in the screenshot, you can use the online command help with the –help or -h parameter.
You can check the task by running the following command:
1 2 3 | az group list |
If you want to know more about Azure Resource Groups, check out this link: https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview