ManirajSS
ManirajSS

Reputation: 2375

How do I find the Azure PowerShell version?

I need to find the installed Azure PowerShell version through cmdlets code. How do I find the Azure PowerShell version?

Note: Other than cmdlets code is also welcome.

Upvotes: 33

Views: 70265

Answers (8)

Dilan Perera
Dilan Perera

Reputation: 671

Running the following command in PowerShell gives me the current Azure PowerShell version.

Get-Module -ListAvailable -Name Az

Upvotes: 1

harry
harry

Reputation: 179

Use official :
$PSVersionTable.PSVersion

Upvotes: 3

Jonathan Gao
Jonathan Gao

Reputation: 679

Get-InstalledModule -Name Az -AllVersions | select Name,Version

It is documented in https://learn.microsoft.com/en-us/powershell/azure/install-az-ps.

Upvotes: 21

Icecream
Icecream

Reputation: 69

You can use the following cmdlet to get the Azure PowerShell version as well!

Copy and paste the following, and run it!

(Get-Module -ListAvailable | Where-Object{ $_.Name -eq 'Azure' }) ` | Select Version, Name, Author, PowerShellVersion  | Format-List;

Upvotes: 6

ManirajSS
ManirajSS

Reputation: 2375

Use:

(Get-Module azure).Version

This will return version of installed Azure PowerShell.

Azure PowerShell version

Upvotes: 14

Jules
Jules

Reputation: 31

Get-Module AzureRM -List | Select-Object Name, Version, Path

This is great to run if you have multiple versions running.

Upvotes: 3

Rahul Mohan
Rahul Mohan

Reputation: 533

It runs in AzureServiceManagementMode and not in ARM mode in version 0.8 and 0.9. It works smooth with the version 1.0 and above.

 $name='Azure' 

    if(Get-Module -ListAvailable |  Where-Object { $_.name -eq $name })  
    {  
      (Get-Module -ListAvailable | Where-Object{ $_.Name -eq $name }) |  Select Version, Name, Author, PowerShellVersion  | Format-List;  
    }  
    else  
    {  
        “The Azure PowerShell module is not installed.” 
    }

enter image description here

Cheers!!

Upvotes: 1

juvchan
juvchan

Reputation: 6245

This PowerShell cmdlet will get the Azure PowerShell version.

Get-Module -ListAvailable -Name Azure -Refresh

It has a major advantage in which it will be able to return the expected outcome even if the Azure module has not been loaded into the current PowerShell session.

On the contrary, (Get-Module Azure).Version will only work if the Azure module has been loaded into the current PowerShell session before, i.e. by calling any cmdlet from the Azure module in the current PowerShell session, e.g. Get-AzureStorageAccount

enter image description here

Upvotes: 51

Related Questions