
In this Azure tutorial, we will discuss How To Open Azure PowerShell. Along with this, we will also discuss the below topics.
- How To Open Azure PowerShell Windows 10
- Azure PowerShell Commands
Table of Contents
How To Open Azure PowerShell
Well, there are many ways to open Azure PowerShell. The easiest way and one of the best ways to open the Azure PowerShell are to use the Azure Cloud Shell environment.
Follow the below steps to use the Azure PowerShell in the Azure Cloud Shell environment.
- Sign in to Azure Portal (https://portal.azure.com/).
- Once, you have logged in to Azure Portal, click on the Cloud Shell button that is present before Directories + Suscriptions button on the top navigation.

3. Select the PowerShell environment option from the drop-down as highlighted below.

4. Click on the Confirm button to confirm the PowerShell environment.

You can also install Azure PowerShell on your local machine.
How To Open Azure PowerShell Windows 10
Once you have installed Azure PowerShell on your local machine, follow the below steps to open Azure PowerShell on your local machine.
- Right-click on the PowerShell ISE and select the Run as administrator option.

2. Use the below PowerShell cmdlet to sign in to Azure.
Connect-AzAccount
Once you will execute the above PowerShell cmdlet, it will ask you to provide your Azure credentials.

Provide your username and password for your Azure account and then click on the sign-in button.
3. Now, you can execute the needed PowerShell cmdlet. For example, you can execute the below Azure PowerShell cmdlet to retrieve the Azure Subscription details.
Get-AzSubscription
Once you will execute the above PowerShell cmdlet, you can get the below output.

Azure PowerShell Commands
Well, let’s discuss a few key Azure PowerShell Commands.
Below are a few lists of Azure PowerShell commands that are part of Az.Resources PowerShell module.
Add-AzADGroupMember
This Azure PowerShell cmdlet can help you to add a user to an existing AD Group.
Syntax: Below is the syntax for the Add-AzADGroupMember PowerShell cmdlet.
Add-AzADGroupMember -MemberObjectId <String[]> -TargetGroupObjectId <String>
[-PassThru] [-DefaultProfile <IAzureContextContainer>][-WhatIf][-Confirm]
[<CommonParameters>]
Example: Let’s consider an example where it adds the user with object id ‘G6095FFC-F43K-5207-8C79-A9E6HJ5B8903′ to the group with object id ’96G34G60-760G-5BB7-0H4F-7J856K377GHH’.
Add-AzADGroupMember -MemberObjectId G6095FFC-F43K-5207-8C79-A9E6HJ5B8903 -TargetGroupObjectId 96G34G60-760G-5BB7-0H4F-7J856K377GHH
Get-AzADGroupMember
This Azure PowerShell cmdlet helps you to lists members of Active Directory Groups in the current tenant.
Syntax: Below is the syntax for the Get-AzADGroupMember PowerShell cmdlet.
Get-AzADGroupMember
[-GroupObjectId <String>]
[-DefaultProfile <IAzureContextContainer>]
[-IncludeTotalCount]
[-Skip <UInt64>]
[-First <UInt64>]
[<CommonParameters>]
Example: Let’s consider an example that will list members by AD group object id
Get-AzADGroupMember -GroupObjectId 96G78H91-654E-4KL6-9J5L-4HI75D766MMM
This will list members of the AD group with object id ’96G78H91-654E-4KL6-9J5L-4HI75D766MMM’.
New-AzADGroup
This Azure PowerShell cmdlet helps you to create a new active directory group.
Syntax: Below is the syntax for the New-AzADGroup PowerShell cmdlet.
New-AzADGroup -DisplayName <String> -MailNickname <String>[-Description <String>]
[-DefaultProfile <IAzureContextContainer>][-WhatIf][-Confirm][<CommonParameters>]
Example: Let’s consider an example that will create a new AD group with the name “TSInfo” and the mail nickname “TSInfoNick”.
New-AzADGroup -DisplayName "TSInfo" -MailNickname "TSInfoNick"
New-AzADUser
This Azure PowerShell cmdlet helps you to create a new active directory user.
Syntax: Below is the syntax for the New-AzADUser PowerShell cmdlet.
New-AzADUser
-DisplayName <String>
-UserPrincipalName <String>
-Password <SecureString>
[-ImmutableId <String>]
-MailNickname <String>
[-ForceChangePasswordNextLogin]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Let’s consider an example that creates a new AD user with the name “TSInfo” and user principal name “tsinfoemail@domain.com” in a tenant.
PS C:\WINDOWS\system32> $SecurePswd = ConvertTo-SecureString -String "pswd" -AsPlainText -Force
PS C:\WINDOWS\system32> New-AzADUser -DisplayName "TSInfo" -UserPrincipalName "tsinfoemail@domain.com" -Password $SecurePswd -MailNickname "TSInfoNickName"
Get-AzADAppCredential
This Azure PowerShell cmdlet helps you to retrieve a list of credentials associated with an application.
Syntax: Below is the syntax for the Get-AzADAppCredential PowerShell cmdlet.
Get-AzADAppCredential
-ObjectId <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Example: Let’s consider an example that will help you to get application credentials with object id 1g88ik96-0895-7lke-jkti-2021j0776098.
PS C:\WINDOWS\system32> Get-AzADAppCredential -ObjectId 1g88ik96-0895-7lke-jkti-2021j0776098
New-AzADSpCredential
This Azure PowerShell cmdlet helps you to add a credential to an existing service principal.
Syntax: Below is the syntax for the New-AzADSpCredential PowerShell cmdlet.
New-AzADSpCredential
-ObjectId <String>
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Let’s consider an example
New-AzADSpCredential -ObjectId 1f99cf81-0146-4f4e-beae-2007d0668476
Secret : System.Security.SecureString
StartDate : 12/12/2021 8:40:07 PM
EndDate : 11/12/2021 8:40:07 PM
KeyId : xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Type : Password
New-AzADServicePrincipal
This Azure PowerShell cmdlet helps you to create a new Azure Active Directory principal.
Syntax: Below is the syntax for the New-AzADServicePrincipal PowerShell cmdlet.
New-AzADServicePrincipal
[-ApplicationId <Guid>]
[-DisplayName <String>]
[-StartDate <DateTime>]
[-EndDate <DateTime>]
[-Scope <String>]
[-Role <String>]
[-SkipAssignment][-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Below are a few lists of Azure PowerShell commands that are part of Az.Compute PowerShell module.
Get-AzVM
This Azure PowerShell cmdlet helps you to get the properties of a virtual machine..
Syntax: Below is the syntax for the Get-AzVM PowerShell cmdlet.
Get-AzVM
[[-ResourceGroupName] <String>]
[[-Name] <String>]
[-Status]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Example: Let’s consider an example that will get model and instance view properties.
Get-AzVM -ResourceGroupName "MyDemoRSG" -Name "TSInfoVM"
Get-AzVMSize
This Azure PowerShell cmdlet helps you to get the size of the available Virtual Machines.
Syntax: Below is the syntax for the Get-AzVMSize PowerShell cmdlet.
Get-AzVMSize
[-Location] <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
Get-AzVMUsage
This Azure PowerShell cmdlet helps you to get the virtual machine core count usage for a location.
Syntax: Below is the syntax for the Get-AzVMUsage PowerShell cmdlet.
Get-AzVMUsage
[-Location] <String>
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
New-AzVM
This Azure PowerShell cmdlet helps you to create a virtual machine.
Syntax: Below is the syntax for the New-AzVM PowerShell cmdlet.
New-AzVM
[-ResourceGroupName] <String>
[-Location] <String>
[-EdgeZone <String>]
[-VM] <PSVirtualMachine>
[[-Zone] <String[]>]
[-DisableBginfoExtension]
[-Tag <Hashtable>]
[-LicenseType <String>]
[-AsJob]
[-OSDiskDeleteOption <String>]
[-DataDiskDeleteOption <String>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm[<CommonParameters>]
Restart-AzVM
This Azure PowerShell cmdlet helps you to restart an Azure virtual machine.
Syntax: Below is the syntax for the Restart-AzVM PowerShell cmdlet.
Restart-AzVM
[-ResourceGroupName] <String>
[-Name] <String>
[-AsJob]
[-NoWait]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Example: Let’s consider an example that will help you to restart the Virtual Machine named as TSInfoVM.
Restart-AzVM -ResourceGroupName "MyDemoRSG" -Name "TSInfoVM"
Start-AzVM
This Azure PowerShell cmdlet helps you to start an Azure virtual machine.
Syntax: Below is the syntax for the Start-AzVM PowerShell cmdlet.
Start-AzVM [-Name] <String> [-NoWait] [-ResourceGroupName] <String> [-AsJob]
[-DefaultProfile <IAzureContextContainer>][-WhatIf][-Confirm][<CommonParameters>]
Example: Let’s consider an example that will help you to start the Virtual Machine named as TSInfoVM.
Start-AzVM -ResourceGroupName "MyDemoRSG" -Name "TSInfoVM"
Stop-AzVM
This Azure PowerShell cmdlet helps you to stop an Azure virtual machine.
Syntax: Below is the syntax for the Start-AzVM PowerShell cmdlet.
Stop-AzVM
[-Name] <String>
[-Force]
[-StayProvisioned]
[-NoWait]
[-SkipShutdown]
[-ResourceGroupName] <String>
[-AsJob]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf][-Confirm]
[<CommonParameters>]
Example: Let’s consider an example that will help you to stop the Virtual Machine named as TSInfoVM.
Stop-AzVM -ResourceGroupName "MyDemoRSG" -Name "TSInfoVM"
Update-AzVM
This Azure PowerShell cmdlet helps you to update the state of an Azure virtual machine.
Syntax: Below is the syntax for the Update-AzVM PowerShell cmdlet.
Update-AzVM
[-ResourceGroupName] <String>
-VM <PSVirtualMachine>
[-Tag <Hashtable>]
[-OsDiskWriteAccelerator <Boolean>]
[-UltraSSDEnabled <Boolean>]
[-MaxPrice <Double>]
[-EncryptionAtHost <Boolean>]
[-ProximityPlacementGroupId <String>]
[-HostId <String>]
[-CapacityReservationGroupId <String>]
[-AsJob]
[-NoWait]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-AzVMSecret
This Azure PowerShell cmdlet helps you to add a secret to a virtual machine.
Syntax: Below is the syntax for the Add-AzVMSecret PowerShell cmdlet.
Add-AzVMSecret
[-VM] <PSVirtualMachine>
[[-SourceVaultId] <String>]
[[-CertificateStore] <String>]
[[-CertificateUrl] <String>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
You may also like following below articles
- How to enable self-service password reset in Azure AD
- How to Upload and Download File From Azure Blob Storage Using C# and PowerShell
- Step-by-Step Guide: How to Encrypt Azure Linux VM PowerShell
- How To Create Azure Windows Virtual Machine From A Snapshot PowerShell
- How To Move Azure VM To A Different Resource Group PowerShell?
- Azure PowerShell List Virtual Machines
Wrapping Up
Well, in this article, we have discussed How To Open Azure PowerShell and along with that we have also discussed the below topics.
- How To Open Azure PowerShell
- How To Open Azure PowerShell Windows 10
- Azure PowerShell Commands
Hope you have enjoyed this article !!!