Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Update Azure Powershell module with Powershell
# Get latest azure-powershell
$AzureModule = Get-Module -Name Azure* -ListAvailable
$LatestRelease = Invoke-RestMethod -Uri https://api.github.com/repos/Azure/azure-powershell/releases/latest -Method GET
If (-not($AzureModule) -or $AzureModule.Version.ToString() -ne $LatestRelease.name)
{
$Asset = $LatestRelease.assets | Where-Object {$_.name -like "*.msi"}
$OutFile = "{0}\{1}" -f $env:TEMP, $Asset.name
Invoke-WebRequest -Uri $Asset.browser_download_url -OutFile $Outfile -Method Get
Start-Process -FilePath msiexec.exe -ArgumentList @("/i $OutFile /qb") -Wait -PassThru
}
else
{
Write-Host "Azure Powershell module is up to date."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.