Azure PowerShell Overview
Azure PowerShell is a set of cmdlets that leverage the .NET framework for managing Azure resources. You can use Azure PowerShell to manage Azure resources that were deployed through Azure Resource Manager, as well as earlier Azure service management models.
With Azure PowerShell, you can:
- Create, configure, and manage Azure services from the command line.
- Automate resource deployment and management tasks.
- Integrate Azure management into your existing DevOps workflows.
- Query resource states and monitor service health.
Key Concepts
- Cmdlets: The core commands in Azure PowerShell, typically following a Verb-Noun naming convention (e.g.,
Get-AzVM,New-AzResourceGroup). - Modules: Collections of related cmdlets and resources. The Azure PowerShell module is typically named
Az. - Providers: Allow PowerShell to interact with a hierarchical data store, such as Azure Resource Manager.
- Context: Represents the connection to your Azure subscription and the current tenant.
Getting Started
To begin using Azure PowerShell, you need to install the Azure PowerShell module. The recommended way to install it is using PowerShellGet.
Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force
After installation, you can connect to your Azure account:
Connect-AzAccount
This command will open a browser window for you to authenticate with your Azure credentials.
Core Cmdlets
Here are some frequently used cmdlets:
Get-AzResourceGroup: Lists resource groups.New-AzResourceGroup: Creates a new resource group.Get-AzVM: Lists virtual machines.New-AzVM: Creates a new virtual machine.Set-AzVM: Updates a virtual machine.Remove-AzVM: Deletes a virtual machine.