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.
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.
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
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 firstname.lastname@example.org 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)
First is the Discover Section.
DISCOVER AZURE RESOURCES
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.
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.
CREATE AZURE RESOURCE
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
Select the location and click OK
Give your Resource Group a name and press enter
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.
Switch back to the portal to see new RG.
Let’s create new storage account. Type in 17 and press enter
Select subscription and press OK. Next select the resource group
Give your storage account a name and press enter
Select the Location
Select the SKU name
and the storage kind
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.
DELETE AZURE RESOURCES
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!