AzureSimpleREST Module

This post is also available in Deutsch

Although Microsoft does a great job with their AzureRM Modul module, there are always reasons not to use these Cmdlets. In most cases because they are slower than direct requests against the Azure REST API. In other cases because certain functionality has not yet been implemented.

The module AzureSimpleREST written by me positions itself in this gap

The module contains e.g. functions like “Get-AzSRVMProtectionStatus” which uses an officially documented REST Call, but I don’t know any AzureRM Cmdlet that provides this function. So with the following command

possible to check if a virtual Machine is protected by Azure Backup.
How I came up with this REST method, I described in another blog entry.

Why write you own Module

I decided to create my own module because it makes things a lot easier. For example, I could include the great function ‘Get-AzureRmCachedAccessToken‘ by Stéphane Lapointe and ‘Get-SubnetAddress’ by Dave Wyatt directly.
Both have published their code under the MIT license.

These functions e.g. use the login capability of the official AzureRM module and as a result no service principal is required. This makes it easier to get started.

Installation

You can find the module in the PowerShell Gallery and install it with ‘Install-Module AzureSimpleREST -Scope Current User’.

Usage

All commands start with the abbreviation AzSR for Azure Simple REST.
There is also a help with examples for each Cmdlet. Many of the Cmdlets build on each other and can be connected by the PowerShell pipeline.

Subscription Management

Unlike the official AzureRM Cmdlets, these Cmdlets do not have a subscription context. The subscription Id must be passed if required. If you only work with one subscription and don’t want to specify it every time, you can use ‘PSDefaultParameterValues‘.

The command sets the default value for all Cmdlets that expect the ‘SubscriptionId’ parameter to the one you defined. If you want to overwrite it you just have to specify the parameter.

Contribute

The complete module is also published under the MIT license on GitHub. Anyone can create a pull request and help to extend the module.

Next steps

Currently I am writing Pester tests for all functions. The goal is to only include functions that can be tested with a Pester test.
More about this in another blog entry.

Ich arbeite als IT Consultant bei Aequitas Integration und habe einen Fokus auf die Microsoft Enterprise Produktpalette.
Jedoch beschäftige ich mich schon lange auch mit Linux und finde auch die unteren OSI Schichten interessant.

This entry was posted in Azure, Module, PowerShell on by .

About

Ich arbeite als IT Consultant bei Aequitas Integration und habe einen Fokus auf die Microsoft Enterprise Produktpalette. Jedoch beschäftige ich mich schon lange auch mit Linux und finde auch die unteren OSI Schichten interessant.