Downloads:

125,783

Downloads of v 5.0.0:

6,348

Last Update:

3/22/2018

Package Maintainer(s):

Software Author(s):

  • Microsoft

Tags:

microsoft azure powershell module azurerm resource manager admin

Microsoft Azure PowerShell

This is not the latest version of Microsoft Azure PowerShell available.

5.0.0 | Updated: 3/22/2018

Downloads:

125,783

Downloads of v 5.0.0:

6,348

Software Author(s):

  • Microsoft

Microsoft Azure PowerShell 5.0.0

This is not the latest version of Microsoft Azure PowerShell available.

This Package Contains an Exempted Check

1 Test Passing and 1 Exempted Test


Validation Testing Passed


Verification Testing Exempt:

Requires 4.5.2 which requires a reboot.

To install Microsoft Azure PowerShell, run the following command from the command line or from PowerShell:

>

To upgrade Microsoft Azure PowerShell, run the following command from the command line or from PowerShell:

>

To uninstall Microsoft Azure PowerShell, run the following command from the command line or from PowerShell:

>

NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://chocolatey.org/api/v2. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Enter your internal repository url

(this should look similar to https://chocolatey.org/api/v2)

4. Choose your deployment method:


choco upgrade azurepowershell -y --source="'STEP 3 URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade azurepowershell -y --source="'STEP 3 URL'" 
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Ensure azurepowershell installed
  win_chocolatey:
    name: azurepowershell
    state: present
    version: 5.0.0
    source: STEP 3 URL

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.

Coming early 2020! Central Managment Reporting available now! More information...


chocolatey_package 'azurepowershell' do
  action    :install
  version  '5.0.0'
  source   'STEP 3 URL'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


Chocolatey::Ensure-Package
(
    Name: azurepowershell,
    Version: 5.0.0,
    Source: STEP 3 URL
);

Requires Otter Chocolatey Extension. See docs at https://inedo.com/den/otter/chocolatey.


cChocoPackageInstaller azurepowershell
{
   Name     = 'azurepowershell'
   Ensure   = 'Present'
   Version  = '5.0.0'
   Source   = 'STEP 3 URL'
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'azurepowershell':
  provider => 'chocolatey',
  ensure   => '5.0.0',
  source   => 'STEP 3 URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


salt '*' chocolatey.install azurepowershell version="5.0.0" source="STEP 3 URL"

See docs at https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.chocolatey.html.

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

Private CDN cached downloads available for licensed customers. Never experience 404 breakages again! Learn more...

This package was approved by moderator gep13 on 3/23/2018.

Description

Azure PowerShell provides a set of cmdlets that use the Azure Resource Manager model for managing your Azure resources. You can use it in your browser with Azure Cloud Shell, or you can install it on your local machine and use it in any PowerShell session.

Azure PowerShell requires PowerShell 3.0 or later, which can be installed using the powershell package. This package does not define a dependency on that package to avoid causing a potentially undesired update to the newest PowerShell.

This package modifies the Azure PowerShell installation process in order to stop the Azure PowerShell installer from:
- killing all powershell.exe and powershell_ise.exe processes (to prevent data loss),
- modifying the PowerShell execution policy (because the user should be in control of that).


tools\ChocolateyInstall.ps1
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2

$packageName = 'azurepowershell'
$moduleVersion = [version]'5.0.0'
$url = 'https://github.com/Azure/azure-powershell/releases/download/v5.0.0-November2017/azure-powershell.5.0.0.msi'
$checksum = '50C1A943739D2043C3D74B601908B6E21CEFF90CAD6E30D86F931016FA6A2F5D'
$checksumType = 'sha256'

. (Join-Path -Path (Split-Path -Path $MyInvocation.MyCommand.Path) -ChildPath helpers.ps1)

Ensure-RequiredPowerShellVersionPresent -RequiredVersion '3.0'

if (Test-AzurePowerShellInstalled -RequiredVersion $moduleVersion)
{
    return
}

$scriptDirectory = $PSScriptRoot # safe to use because we test for PS 3.0+ earlier
$originalMsiLocalPath = Join-Path -Path $scriptDirectory -ChildPath "azure-powershell.${moduleVersion}.msi"

$downloadArguments = @{
    packageName = $packageName
    fileFullPath = $originalMsiLocalPath
    url = $url
    checksum = $checksum
    checksumType = $checksumType
}

Set-StrictMode -Off # unfortunately, builtin helpers are not guaranteed to be strict mode compliant
Get-ChocolateyWebFile @downloadArguments | Out-Null
Set-StrictMode -Version 2

Write-Host 'Modifying the Azure PowerShell installer to prevent it from killing powershell.exe and adjusting the execution policy'
$transformLocalPath = New-AzurePowerShellInstallerTransform -OriginalMsiPath $originalMsiLocalPath -ActionsToRemove @('WixCloseApplications', 'SetExecutionPolicy')

$instArguments = @{
    packageName = $packageName
    installerType = 'msi'
    file = $originalMsiLocalPath
    silentArgs = '/Quiet /NoRestart /Log "{0}\{1}_{2:yyyyMMddHHmmss}.log" TRANSFORMS="{3}"' -f $Env:TEMP, $packageName, (Get-Date), $transformLocalPath
    validExitCodes = @(
        0, # success
        3010 # success, restart required
    )
}

Set-StrictMode -Off
Install-ChocolateyInstallPackage @instArguments

Write-Warning 'You may need to close and reopen PowerShell before the Azure PowerShell modules become available.'
tools\helpers.ps1
$ErrorActionPreference = 'Stop'
Set-StrictMode -Version 2

Set-Variable -Option Constant -Scope Script -Name msiOpenDatabaseModeReadOnly -Value 0
Set-Variable -Option Constant -Scope Script -Name msiOpenDatabaseModeTransact -Value 1
Set-Variable -Option Constant -Scope Script -Name msiTransformErrorNone -Value 0
Set-Variable -Option Constant -Scope Script -Name msiTransformValidationNone -Value 0

function Ensure-RequiredPowerShellVersionPresent
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory = $true)] [version] $RequiredVersion
    )

    # 3.0 is the absolute minimum requirement, but future packages might require a newer version
    if (-not (Test-Path -Path "HKLM:\Software\Microsoft\PowerShell\3") -or $PSVersionTable -eq $null -or $PSVersionTable.PSVersion -lt [version]$RequiredVersion)
    {
        throw "Azure PowerShell requires PowerShell version $RequiredVersion or greater. You can install it using the 'powershell' package." 
    }
    else
    {
        Write-Debug "Running on PowerShell $RequiredVersion or later (actually: $($PSVersionTable.PSVersion))"
    }
}

function Test-AzurePowerShellInstalled
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory = $true)] [version] $RequiredVersion
    )

    $newestModule = Get-Module -Name AzureRM.* -ListAvailable | Sort-Object -Property Version -Descending | Select-Object -First 1
    if ($newestModule -ne $null -and $newestModule.Version -ge $RequiredVersion)
    {
        Write-Host "Azure PowerShell version $RequiredVersion or later is already installed (detected module $($newestModule.Name) version $($newestModule.Version))."
        return $true
    }
    else
    {
        if ($newestModule -ne $null)
        {
            Write-Debug "Azure PowerShell version $RequiredVersion or later is not installed (detected module $($newestModule.Name) version $($newestModule.Version))."
        }
        else
        {
            Write-Debug "Azure PowerShell version $RequiredVersion or later is not installed (no modules detected)."
        }

        return $false
    }
}

function Invoke-Method
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory = $true)] [object] $Object,
        [Parameter(Mandatory = $true)] [string] $MethodName,
        [Parameter(Mandatory = $true)] [AllowEmptyCollection()] [object[]] $ArgumentList
    )

    return $Object.GetType().InvokeMember($MethodName, 'Public, Instance, InvokeMethod', $null, $Object, $ArgumentList)
}

function New-ModifiedAzurePowerShellInstaller
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory = $true)] [string] $OriginalMsiPath,
        [Parameter(Mandatory = $true)] [string[]] $ActionsToRemove
    )

    $originalMsi = Get-Item -Path $OriginalMsiPath
    # Curiously, Join-Path seems to return an object which "looks" like System.String but is not accepted by COM
    # (OpenDatabase throws DISP_E_TYPEMISMATCH). An explicit cast to [string] prevents that.
    [string]$modifiedMsiPath = Join-Path -Path (Split-Path -Path $OriginalMsiPath -Parent) -ChildPath ('{0}_patched{1}' -f $originalMsi.BaseName, $originalMsi.Extension)

    Write-Debug "Creating $modifiedMsiPath as a copy of $OriginalMsiPath"
    $originalMsi | Copy-Item -Destination $modifiedMsiPath -Force

    $whereClauses = $ActionsToRemove | ForEach-Object { "`Action`='$_'" }
    $query = 'DELETE FROM `InstallExecuteSequence` WHERE {0}' -f ($whereClauses -join ' OR ')

    Write-Debug 'Creating WindowsInstaller.Installer object'
    $wi = New-Object -ComObject WindowsInstaller.Installer
    try
    {
        Write-Debug "Opening MSI $modifiedMsiPath"
        $db = Invoke-Method -Object $wi -MethodName OpenDatabase -ArgumentList @($modifiedMsiPath, $script:msiOpenDatabaseModeTransact)
        try
        {
            Write-Debug "Opening view with query: $query"
            $v = Invoke-Method -Object $db -MethodName OpenView -ArgumentList @($query)
            try
            {
                Write-Debug 'Executing query'
                Invoke-Method -Object $v -MethodName Execute -ArgumentList @() | Out-Null
                Write-Debug 'Closing view'
                Invoke-Method -Object $v -MethodName Close -ArgumentList @() | Out-Null
            }
            finally
            {
                [Runtime.InteropServices.Marshal]::ReleaseComObject($v) | Out-Null
                $v = $null
            }

            Write-Debug 'Committing MSI changes'
            Invoke-Method -Object $db -MethodName Commit -ArgumentList @() | Out-Null
        }
        finally
        {
            [Runtime.InteropServices.Marshal]::ReleaseComObject($db) | Out-Null
            $db = $null
        }
    }
    finally
    {
        [Runtime.InteropServices.Marshal]::ReleaseComObject($wi) | Out-Null
        $wi = $null
    }

    return $modifiedMsiPath
}

function New-AzurePowerShellInstallerTransform
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory = $true)] [string] $OriginalMsiPath,
        [Parameter(Mandatory = $true)] [string[]] $ActionsToRemove
    )

    $originalMsi = Get-Item -Path $OriginalMsiPath
    $modifiedMsiPath = New-ModifiedAzurePowerShellInstaller @PSBoundParameters
    # explicit cast to [string] explained in New-ModifiedAzurePowerShellInstaller
    [string]$transformPath = Join-Path -Path (Split-Path -Path $OriginalMsiPath -Parent) -ChildPath ('{0}_transform.mst' -f $originalMsi.BaseName)

    Write-Debug 'Creating WindowsInstaller.Installer object'
    $wi = New-Object -ComObject WindowsInstaller.Installer
    try
    {
        Write-Debug "Opening MSI $modifiedMsiPath (read-only)"
        $db = Invoke-Method -Object $wi -MethodName OpenDatabase -ArgumentList @($modifiedMsiPath, $script:msiOpenDatabaseModeReadOnly)
        try
        {
            Write-Debug "Opening MSI $OriginalMsiPath (read-only)"
            $dbOrig = Invoke-Method -Object $wi -MethodName OpenDatabase -ArgumentList @($OriginalMsiPath, $script:msiOpenDatabaseModeReadOnly)
            try
            {
                Write-Debug "Generating transform $transformPath"
                Invoke-Method -Object $db -MethodName GenerateTransform -ArgumentList @($dbOrig, $transformPath) | Out-Null
                Write-Debug "Creating transform summary info in $transformPath"
                Invoke-Method -Object $db -MethodName CreateTransformSummaryInfo -ArgumentList @($dbOrig, $transformPath, $msiTransformErrorNone, $msiTransformValidationNone) | Out-Null
            }
            finally
            {
                [Runtime.InteropServices.Marshal]::ReleaseComObject($dbOrig) | Out-Null
                $dbOrig = $null
            }
        }
        finally
        {
            [Runtime.InteropServices.Marshal]::ReleaseComObject($db) | Out-Null
            $db = $null
        }
    }
    finally
    {
        [Runtime.InteropServices.Marshal]::ReleaseComObject($wi) | Out-Null
        $wi = $null
    }

    Write-Debug "Removing $modifiedMsiPath"
    Remove-Item -Path $modifiedMsiPath -ErrorAction SilentlyContinue

    return $transformPath
}

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
Microsoft Azure PowerShell 6.8.1 4407 Thursday, August 30, 2018 Approved
Microsoft Azure PowerShell 6.6.0 14116 Friday, July 27, 2018 Approved
Microsoft Azure PowerShell 6.4.0 19677 Tuesday, July 3, 2018 Approved
Microsoft Azure PowerShell 6.3.0 6696 Tuesday, June 19, 2018 Approved
Microsoft Azure PowerShell 6.2.1 2229 Wednesday, June 6, 2018 Approved
Microsoft Azure PowerShell 6.1.0 3610 Tuesday, May 22, 2018 Approved
Microsoft Azure PowerShell 6.0.0 2511 Monday, May 7, 2018 Approved
Microsoft Azure PowerShell 5.7.0 12029 Tuesday, April 10, 2018 Approved
Microsoft Azure PowerShell 5.6.0 278 Tuesday, March 27, 2018 Approved

Software

Azure PowerShell release notes

Package

5.0.0: Initial package release for software version 5.0.0.


Discussion for the Microsoft Azure PowerShell Package

Ground Rules:

  • This discussion is only about Microsoft Azure PowerShell and the Microsoft Azure PowerShell package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or Microsoft Azure PowerShell, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus