Description

The Az PowerShell module is a set of cmdlets for managing Azure resources directly from PowerShell. PowerShell provides powerful features for automation that can be leveraged for managing your Azure resources, for example in the context of a CI/CD pipeline.

The Az PowerShell module is the replacement for AzureRM and is the recommended module to use for interacting with Azure.

Requirements

  • Account credentials

How to Use

1. Install the Powershell module

  • Install-Module -Name Az -Scope CurrentUser -Repository PSGallery -Force

2. List the help menu

  • Get-Help Az

3. Connect to Azure Cloud

  • Connect-AzAccount

Note: You can also authenticate using credentials

  • $credentials = Get-Credential
  • Connect-AzAccount -Credential $credentials

4. Once logged in, you are displayed Account, SubscriptionName, TenantId, Environment

Enumerate current Context

Get-AzContext

1. This cmdlet gets the Active Directory account, Active Directory tenant, Azure subscription, and the targeted Azure environment. Azure Resource Manager cmdlets use these settings by default when making Azure Resource Manager requests.

  • Get-AzContext -ListAvailable

Get-AzSubscription

The Get-AzSubscription cmdlet gets the subscription ID, subscription name, and home tenant for subscriptions that the current account can access.

  • Get-AzSubscription

Get-AzRoleAssignment

Use the Get-AzRoleAssignment command to list all role assignments that are effective on a scope. Without any parameters, this command returns all the role assignments made under the subscription. This list can be filtered using filtering parameters for principal, role and scope.

  • Get-AzRoleAssignment

Get-AzResource

The Get-AzResource cmdlet gets Azure resources.

  • Get-AzResource

Get-AzResourceGroup

The Get-AzResourceGroup cmdlet gets Azure resource groups in the current subscription. You can get all resource groups, or specify a resource group by name or by other properties. By default, this cmdlet gets all resource groups in the current subscription. For more information about Azure resources and Azure resource groups, see the New-AzResourceGroup cmdlet.

  • Get-AzResourceGroup

Get-AzStorageAccount

The Get-AzStorageAccount cmdlet gets a specified Storage account or all of the Storage accounts in a resource group or the subscription.

  • Get-AzStorageAccount

Get-AzWebApp

The Get-AzWebApp cmdlet gets information about an Azure Web App.

  • Get-AzWebApp

Get-AzAutomationAccount

The Get-AzAutomationAccount cmdlet gets Azure Automation accounts in a resource group.

  • Get-AzAutomationAccount

Get-AzVirtualNetwork

The Get-AzVirtualNetwork cmdlet gets one or more virtual networks in a resource group.

  • Get-AzVirtualNetwork

Get-AzPublicIPAddress

The Get-AzPublicIPAddress cmdlet gets one or more public IP addresses in a resource group.

  • Get-AzPublicIPAddress

Get-AzVpnConnection

Gets a vpn connection by name or lists all vpn connections connected to a VpnGateway.

  • Get-AzVpnConnection

References

https://learn.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-11.5.0