
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
- Important PowerShell Commands in Azure
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 is 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 the Directories + Subscriptions 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 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 execute the above PowerShell cmdlet, you can get the below output.

How to open PowerShell in Azure Portal
You can also use PowerShell in Azure Portal using the below steps.
- Login to Azure Portal.
- Click on the Cloud Shell option from the top right as highlighted below.

3. Select the PowerShell option from the Dropdown. Refer to the below screenshot.

4. Now, click on the confirm button as shown below.

Important PowerShell Commands in Azure
Well, let’s discuss a few key PowerShell Commands in Azure.
Below are a few lists of PowerShell commands in Azure that are part of Az. Resources PowerShell module.
Get-AzADAppCredential
This Azure PowerShell cmdlet helps you 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 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 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>]
Check out the complete lists of Azure PowerShell Commands now.
You may also like the following articles
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
- Important PowerShell Commands in Azure
Hope you have enjoyed this article !!!