PowerShell–Azure ‘Az’ Module

January 1, 2019

A few weeks ago there was a new Module released for Azure called, Azure PowerShell ‘Az’ Module version 1.0

Az runs on Windows PowerShell 5.1 and PowerShell Core (cross-platform)

It can be used side-by-side the existing AzureRM Module.

But new features will only be released in the Az module.

To install the new module run this command using Admin priviliges.

Install -Module -Name Az

image

To see if the installation was successful run this command

Get-Module -ListAvailable "Az*"

image

To list all the commands run this command

Get-Command -Name *Az*

image

The connection method has been changed compared to what you are used to.

The Get-Credential cmdlet is replaced with Connect-AzAccount

Once executed you will see this reply

image

Go to the URL https://microsoft.com/devicelogin and fill in the code you got using this command

Connect-AzAccount

image

For more info see here

How to migrate scripts from AzureRM to Az see here

Enjoy !!


PowerShell – Monitor MS Azure Status

February 22, 2015

If you are using MS Azure or MS Office 365 you are depending on the uptime of all the MS Cloud services.

Well to monitor this there is the Azure Status site.

image

This site offers for each service a RSS subscription to monitor the status.

In this case there was an issue, so we can kick in Powershell to grab the RSS output.

Here we go

 

CLS

$hsg = Invoke-WebRequest  "http://azure.microsoft.com/en-us/status/feed/"

$hsg.Content

[xml]$ret = $hsg.Content.TrimStart("")

#$ret.rss.channel.item | Select-Object *

write-host ""



if($ret.rss.channel.item.category -eq $null){

        write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
        write-host "All services are working properly"
        write-host ""
    }
Else
    {

    write-host $ret.rss.channel.title " On : "  $ret.rss.channel.pubDate
    Write-Host "Issue Category : " $ret.rss.channel.item.category
    write-host ""
    Write-Host "Details : " $ret.rss.channel.item.title

    $ret.rss.channel.item.description
    write-host ""

}

rv hsg, ret
image

As you can see the raw XML data is prefixed (deliberately or not?) by a few strange characters which we have to eliminate before PowerShell can dig it.

So the final output is like this.

image

So you can create a job to have this run at a frequency to check for uptime issues.

Enjoy!