- 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’
Advertisements
To Continue Learning Please Login
Login with Google