- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to create a new Azure resource group using PowerShell?
Azure Resource Group is a container that stores the resources like Virtual Machines, Storage, IP addresses, etc. To create a new Azure Resource group, we need to use the New-AZResourceGroup command.
To use this cmdlet, you first need to connect to the Azure account, and then if you want to create a resource group for the particular subscription you need to select that subscription.
To create a new resource group, you need the location for the resource group. The below code will first connect to your Azure account, selects the Azure subscription, and then creates a new resource group.
Example
$ErrorActionPreference = "Stop" Connect-AzAccount Set-AzContext -SubscriptionName 'Enter your subscription name here' New-AzResourceGroup -Name 'TestRG' -Location 'Central US' -Tag @{'RG'='APP'}
Output
ResourceGroupName : TestRG Location : centralus ProvisioningState : Succeeded Tags : Name Value ==== ===== RG APP ResourceId : /subscriptions/8ac5a3e4-390b-9034-8ad5-3585aseesasac/resourceGroups/TestRG
The above command will create the Azure Resource group at the Central US location with the associated tag ‘RG’ and its value ‘APP’
- Related Articles
- How to delete the Azure Resource Group using PowerShell?
- How to get the Azure resource group using Azure CLI in PowerShell?
- How to retrieve the Azure VM resource group using PowerShell?
- How to apply a tag to the azure resource group using PowerShell?
- How to get the azure resources from the resource group using PowerShell?
- How to create a new local group using PowerShell?
- How to check if the Azure resource group is empty or not using PowerShell?
- How to get the applied azure resource tags using PowerShell?
- How to delete all the tags of the azure resource using PowerShell?
- How to add the new tag to Azure VM using PowerShell?
- How to create the Azure Storage context using PowerShell?
- How to retrieve the Azure VM network security group (NSG) using PowerShell?
- How to create a new local user in windows using PowerShell?
- How to connect Azure Account using PowerShell?
- How to retrieve Azure VMs using PowerShell?

Advertisements