December 13, 2018

AzureSaveMoney Module How-To

In this post I will show how to use the AzureSaveMoney PowerShell module; https://www.powershellgallery.com/packages/AzureSaveMoney to reduce the cost and clutter of your Azure subscriptions.

The AzureSaveMoney PowerShell module can report on and clean up the following resources:

Network Interfaces

Public IP Addresses

Network Security Groups

Empty Resource Groups

Old Resource Group Deployments

Classic Alerts on resource no longer available

Log Alerts on resource no longer available

Unused Alert Action Groups

Virtual Networks without subnets

Unused Route Tables

Unused Managed Disks

Empty AAD Groups

Disabled Logic Apps

Old disk snapshots

Load balancers with no backend pool

Disabled Traffic Manager profiles

Traffic Manager profiles with no endpoints

Unconnected Virtual Network Gateways

Expired Webhooks

To start using the module and start saving money install the module using the following PowerShell command.

Install-Module -Name AzureSaveMoney

After installing you may need to restart your PowerShell window or run the following to import the module to your current session.

Import-Module AzureSaveMoney

After the module is loaded you can start using the commands to list the resources the module can clean up. In most commands either the subscription or the tenant id is required. An easy way to get that information to copy in the commands is to use the following command to list the current subscription information.

Get-AzureRmSubscription

Note: To query the resources, the module will need permissions to all of the resources being queried. You will receive errors if your account does not have the correct permissions to get the data from Azure.

The quickest way to generate a report on all of the resources that the module can clean up is to run the following command which will run all of the checks and output the results to the window. Some commands have other optional parameters, if none are added the defaults will be used.

Get-AzSMAllResources -Subscription 00000000-0000-0000-0000-000000000000 -Tenant 00000000-0000-0000-0000-000000000000

Note: All commands have full PowerShell help support. To view the help for the previous command would be.

Get-Help Get-AzSMAllResources -full

Most of the commands can be piped to remove the resources that are found. To delete all of the unused Network Security Groups by the module use the following command.

Get-AzSMUnusedNSGs -Subscription 00000000-0000-0000-0000-000000000000 | Remove-AzureRmNetworkSecurityGroup

For more information on usage of the module see the readme; https://itoleck.visualstudio.com/AzureSaveMoney

Share

You may also like...