Azure Maintenance Tool is my own powershell module which I created do make my life a little bit easier when administering or documenting Azure environment. Module has 3 sections

  • DISCOVER AZURE RESOURCES
  • CREATE AZURE RESOURCES
  • DELETE AZURE RESOURCES

It was very hard to decide what to have and what to exclude and I decided to have 29 tasks for now. Updated version will have some changes but let’s save it for another day. Module looks like this.

2018-04-26 15_24_07-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

Before you continue be sure to save the module in Program Files (If you would like that all users use it) and by doing this you will have it loaded every time you start the Poweshell Window.

2018-04-26 16_29_03-ultracool.dyndns.org - Fjärrskrivbordsanslutning.png

2018-04-26 16_28_01-ultracool.dyndns.org - Fjärrskrivbordsanslutning.png

If it is only you who will use it be sure to save it in C:\Users\<your username>\Documents(Create this folder if not exists)WindowsPowerShell\Create Folder Modules\and create folder AzureMaintenanceWindow.

OBS!!! The name of the folder must match the name of the Module. Full Path would look like this

C:\Users\<your username>\Documents\WindowsPowerShell\Modules\AzureMaintenanceWindow and in that folder you will need to paste the module.

Next requirement is to install AzureRM module. If you don’t have it you will not be able to run Azure Maintenance Tool.

Once done re-open the Powershell and type in Azure and press tab and it will (If everything is done correctly) find AzureMaintenanceTool module

2018-04-26 16_31_33-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

When you press enter you will be prompted for credentials. Type in your Azure credentials and press OK (OBS!!!! If you use hotmail account like username@outlook.com you will need to edit the module and remove Get-Credential variable $azurecredentials = Get-Credential–> because -Credential parameter cannot be used with Microsoft Accounts) One more thing I notice is if you are using hotmail account the resource creation or resoure discovery is taking longer time or sometime fails. There are no issues with company accounts)

2018-04-26 16_31_55-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

First is the Discover Section.

DISCOVER AZURE RESOURCES

2018-04-26 16_32_58-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

I included a lot of Out-GridView parts to make it easier to select options instead of guessing what RG Name is or what Publisher name is etc.

If you for example type 1 and press Enter it will give you all subscriptions.

2018-04-26 16_35_26-ultracool.dyndns.org - Fjärrskrivbordsanslutning

If you type 2 you will get prompted to select the subscription and then you will get list of all resource groups and so on.

2018-04-26 16_45_43-ultracool.dyndns.org - Fjärrskrivbordsanslutning.png

 

CREATE AZURE RESOURCE

2018-04-30 11_29_47-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

Here we can create new Azure Resources. For example let’s create new resource group. Type in 16 and press enter

Select your subscription, in case you have more than 1 and click OK

2018-04-30 11_53_23-Select subscription

Select the location and click OK

2018-04-30 11_31_08-Select your location.png

Give your Resource Group a name and press enter

2018-04-30 11_31_59-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

And that’s it. I excluded output so you will not get any info but you will get error message in case that something is not good.

2018-04-30 11_32_53-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

Switch back to the portal to see new RG.

2018-04-30 11_57_16-Resource groups - Microsoft Azure

Let’s create new storage account. Type in 17 and press enter

Select subscription and press OK. Next select the resource group

2018-04-30 12_13_15-ultracool.dyndns.org - Fjärrskrivbordsanslutning

Give your storage account a name and press enter

2018-04-30 12_13_56-ultracool.dyndns.org - Fjärrskrivbordsanslutning

Select the Location

2018-04-30 12_14_26-ultracool.dyndns.org - Fjärrskrivbordsanslutning

Select the SKU name

2018-04-30 12_15_54-ultracool.dyndns.org - Fjärrskrivbordsanslutning

and the storage kind

2018-04-30 12_16_26-ultracool.dyndns.org - Fjärrskrivbordsanslutning

2018-04-30 12_22_15-ultracool.dyndns.org - Fjärrskrivbordsanslutning.png

One thing to keep in mind while creating a new VM. You will have to edit the module and change $VNET.Subnets to right subnet. If you have only one subnet you can leave it as is but if you have 2 or more and you would like to use second one you will have to change it to 1 instead of 0 and so on.

2018-05-01 09_42_48-ADMIN NEDIM MEHIC _ NEDIMMEHIC.ORG.png

DELETE AZURE RESOURCES

2018-04-30 12_25_38-ultracool.dyndns.org - Fjärrskrivbordsanslutning.png

Here we can remove azure resources. Process is the same just select what you would like to delete and with a few clicks you are done. When you deleting VM you will have to manually remove Public IP address.

You can download module here AzureMaintenanceTool

Hope you will like it. Thanks for reading!

Cheers,

Nedim