Azure PowerShell – Knowing the basics and starting with few important CMDLETS

PowerShell Module - Get-Help CMDLET
PowerShell Module - Get-Help CMDLET

Hi All,

Greetings for the day πŸ™‚ LIFE IS BEAUTIFUL πŸ™‚

On every weekend we are started sharing basic question and answers (may help to prepare interview , certifications, migration, help to understand basic concepts…) related to Microsoft cloud technologies (Azure, Azure AD, SharePoint, Microsoft 365, Teams, Power Platform and so on)

Today I will share bit about Azure PowerShell

We have list of good articles for preparing Interviews on Azure, Azure AD, Azure Administration, SharePoint, SharePoint Migration, M365, Power Platform. Kindly please visit our Interview Preparation page

Azure PowerShell :

  • Azure PowerShell is a set of cmdlets for managing Azure resources directly from the PowerShell command line
  • Azure PowerShell written in .Net standard
  • Azure PowerShell works with PowerShell 5.1 on Windows, PowerShell 7.0.6 LTS and PowerShell 7.1.3 or higher on all platforms

PowerShell CMDLET :

  • PowerShell CMDLET is PowerShell command
  • A CMDLET is a command for single purpose
  • Cmdlets follow a verb-noun naming convention; for example, Get-Process
  • The Get-Help cmdlet displays the help file for any cmdlet. For example, we could get help on the Get-Module cmdlet with the following statement:
Get-Help Get-Module -detailed

PowerShell Module - Get-Help CMDLET
Fig : PowerShell Module – Get-Help CMDLET

PowerShell Module :

  • CMDLETS comes with PowerShell Module
  • A PowerShell Module is a DLL which contains the code to process each available cmdlet
  • In PowerShell we load CMDLET by loading the respective module
  • Using “Get-Module” we can get list of loaded modules
Get-Module

PowerShell Module - executing 'Get-Module' CMDLET to know the list of loaded module in PowerShell ISE
Fig : PowerShell Module – executing ‘Get-Module’ CMDLET to know the list of loaded module in PowerShell ISE

Az module

  • Az is Azure PowerShell module
  • Az module contains all the CMDLETS to work with Azure features
  • With Az PowerShell module we can work with almost all the resources of Azure
  • We could install Az module using Install-Module CMDLET
Install-Module -Name Az

PowerShell Module - Installing Azure PowerShell module
Fig : PowerShell Module – Installing Azure PowerShell module
  • The above CMDLET will install the Az module for all users
  • If Azure module is already installed we can update latest version by using Update-Module CMDLET
Update-Module -Name Az

To connect Azure Subscription – “Connect-AzAccount– prompts for Azure credentials and connects to Azure subscription

Connect-AzAccount

To get all list of all subscriptions – Get-AzSubscription

Get-AzSubscription

To know the current Azure Subscription we use Get-AzContext

Get-AzContext
PowerShell Module - Knowing the current subscription
Fig: PowerShell Module – Knowing the current subscription

To change the current Azure subscription we will use – Select-AzSubscription

Select-AzSubscription -SubscriptionId <Subscription ID>

To fetch all list of resource groups in active subscription

Get-AzResourceGroup

Creating new resource group

New-AzResourceGroup -Name <name> -Location <location>

To create new VM

New-AzVm -ResourceGroupName "KnowledgeJunctionResourceGroup" -Name "KnowledgeJunction" -Image "UbuntuLTSKnowledgeJunction" -Credential <credentials object> -Location <location>

I’ll stop here, in next article will come up with more CMDLETS πŸ™‚

If you feel some other topics, need to be included in this collection kindly please share or put in comment box. We will definitely include / discuss

Thanks for reading πŸ™‚ If its worth at least reading once, kindly please like and share πŸ™‚ SHARING IS CARING πŸ™‚

Enjoy the beautiful life πŸ™‚ Have a FUN πŸ™‚ HAVE A SAFE LIFE πŸ™‚ TAKE CARE πŸ™‚

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: