All Projects → FBoucher → AzSubscriptionCleaner

FBoucher / AzSubscriptionCleaner

Licence: GPL-3.0 license
Delete automatically the useless resources in your Azure subscription.

Programming Languages

powershell
5483 projects

Projects that are alternatives of or similar to AzSubscriptionCleaner

Mongo Express
Web-based MongoDB admin interface, written with Node.js and express
Stars: ✭ 4,403 (+15082.76%)
Mutual labels:  hacktoberfest2020
Earthly
Repeatable builds
Stars: ✭ 5,805 (+19917.24%)
Mutual labels:  hacktoberfest2020
UberCarAnimation
This app is for animating a car like uber from one position to another with preserving angle and smooth animation
Stars: ✭ 53 (+82.76%)
Mutual labels:  hacktoberfest2020
Awesome Zsh Plugins
A collection of ZSH frameworks, plugins, themes and tutorials.
Stars: ✭ 10,129 (+34827.59%)
Mutual labels:  hacktoberfest2020
Ar.js
Image tracking, Location Based AR, Marker tracking. All on the Web.
Stars: ✭ 3,048 (+10410.34%)
Mutual labels:  hacktoberfest2020
Closedxml
ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.
Stars: ✭ 2,799 (+9551.72%)
Mutual labels:  hacktoberfest2020
Bagisto
An easy to use, free and open source laravel eCommerce platform to build your online shop in no time.
Stars: ✭ 4,140 (+14175.86%)
Mutual labels:  hacktoberfest2020
oauth-jsclient
Intuit's NodeJS OAuth client provides a set of methods to make it easier to work with OAuth2.0 and Open ID
Stars: ✭ 102 (+251.72%)
Mutual labels:  hacktoberfest2020
Fiber
⚡️ Express inspired web framework written in Go
Stars: ✭ 17,334 (+59672.41%)
Mutual labels:  hacktoberfest2020
tetriss
Tetris clone written in JavaScript 🎮 https://antonioolf.github.io/tetriss/
Stars: ✭ 14 (-51.72%)
Mutual labels:  hacktoberfest2020
Materialdesigninxamltoolkit
Google's Material Design in XAML & WPF, for C# & VB.Net.
Stars: ✭ 11,603 (+39910.34%)
Mutual labels:  hacktoberfest2020
Angular Filemanager
JavaScript File Manager Material Design Folder Explorer Navigator Browser Manager in AngularJS with CSS3 Responsive (with FTP in PHP / Java / Node)
Stars: ✭ 1,693 (+5737.93%)
Mutual labels:  hacktoberfest2020
Errbot
Errbot is a chatbot, a daemon that connects to your favorite chat service and bring your tools and some fun into the conversation.
Stars: ✭ 2,605 (+8882.76%)
Mutual labels:  hacktoberfest2020
Mind Expanding Books
📚 Books everyone should read!
Stars: ✭ 7,151 (+24558.62%)
Mutual labels:  hacktoberfest2020
IssueAi
O Issue Ai cria um espaço de visibilidade para os projetos open source de Computação@UFCG.
Stars: ✭ 32 (+10.34%)
Mutual labels:  hacktoberfest2020
Devops Guide
DevOps Guide - Development to Production all configurations with basic notes to debug efficiently.
Stars: ✭ 4,119 (+14103.45%)
Mutual labels:  hacktoberfest2020
Linkedin Skill Assessments Quizzes
Full reference of LinkedIn answers 2021 for skill assessments, LinkedIn test, questions and answers (aws-lambda, rest-api, javascript, react, git, html, jquery, mongodb, java, Go, python, machine-learning, power-point) linkedin excel test lösungen, linkedin machine learning test
Stars: ✭ 7,014 (+24086.21%)
Mutual labels:  hacktoberfest2020
QuickBooks-V3-DotNET-SDK
.Net SDK for QuickBooks REST API v3 services
Stars: ✭ 90 (+210.34%)
Mutual labels:  hacktoberfest2020
website-www.codeuino.org
www.codeuino.org/
Stars: ✭ 35 (+20.69%)
Mutual labels:  hacktoberfest2020
Stanley
An Android app explorer for developers (extract the manifest and other info from any installed application)
Stars: ✭ 82 (+182.76%)
Mutual labels:  hacktoberfest2020

Az Subscription Cleaner

Deploy to Azure GLO Board Serverless Library

Azure Subscription Cleaner

The Simple way to keep your Azure Subscription "clean". This run on a schedule and automatically delete all "expired" resources inside your Azure Subscription, and nothing else.

A Resource is "expired" when it has a tag expireOn older then the current date.


How to deploy

There is two version of this tool. One leveraging the Azure Function the second using Azure Automation. Both are valid options it just depends on your preferences.

Solution 1: with Azure Function

Created using the PowerShell Azure Function all details is available in the azure-function folder

Solution 2: with Azure Automation

The Azure Automation Runbook will execute a PowerShell Script base on a pre-define schedule.

All details are available in the azure-automation folder

To deploy all the resources in your Azure subscription, just click on the Deploy to Azure button.


How Does it works

By Default, the tool will get triggered every morning at 5am and search for any resources tagged with expireOn with a value in the past, and delete them.

Once all the "expired" resources are deleted. It will search for empty Resource Group and delete them too.


Manage Tags

To be able to delete some resources you need to tag them with a tag expireOn and a date as value following the format YYYY-MM-dd.

From the Azure Portal

To add a tag from the portal select any resource. Then from the left panel select the ** Tags** option and add a tag with the name expireOn and the desired date.

add-tag-portal

With PowerShell

The following PowerShell command will add an expireOn tag with the value "2019-08-29" to the resource named demoWebsite in the resource group summerDemo.

    Set-AzResource -ResourceId (Get-AzResource -ResourceGroupName summerDemo -Name demoWebsite).ResourceId -Tag @{expireOn="2019-08-29"}

You could also add tags to a resource group and all its resources. This script will add the tag expireOn with the value "2019-08-29" add populate all resources to this resource group with the same tags.

Set-AzResourceGroup -ResourceId (Get-AzResourceGroup -Name "StreamCleaner").ResourceId -Tag @{expireOn="2019-08-29"}

$group = Get-AzResourceGroup "StreamCleaner"
if ($null -ne $group.Tags) {
    $resources = Get-AzResource -ResourceGroupName $group.ResourceGroupName
    foreach ($r in $resources) {
        $resourcetags = (Get-AzResource -ResourceId $r.ResourceId).Tags
        if ($resourcetags) {
            foreach ($key in $group.Tags.Keys) {
                if (-not($resourcetags.ContainsKey($key))) {
                    $resourcetags.Add($key, $group.Tags.$key)
                }
            }
            Set-AzResource -Tag $resourcetags -ResourceId $r.ResourceId -Force
        }
        else
        {
            Set-AzResource -Tag $group.Tags -ResourceId $r.ResourceId -Force
        }
    }
}

With Azure CLI

It's also possible using Azure CLI.

To add a tag `expireOn' with a value "2019-08-29" to the website demoWebsite IF the resource doesn't have existing tags, use:

az resource tag --tags expireOn=2019-08-29 -g summerDemo -n demoWebsite --resource-type "Microsoft.Web/sites"

This will delete any existing tags on that resource. If the resource has already tags use instead the following code.

To add a tag `expireOn' with a value "2019-08-29" to a website demoWebsite that already has tags, retrieve the existing tags, reformat that value, and reapply the existing and new tags:

jsonrtag=$(az resource show -g summerDemo -n demoWebsite --resource-type "Microsoft.Web/sites" --query tags)

rt=$(echo $jsonrtag | tr -d '"{},\n' | sed 's/: /=/g')

az resource tag --tags $rt expireOn=2019-08-29 -g summerDemo -n demoWebsite --resource-type "Microsoft.Web/sites"

To delete a specific tag value e.g. tag expireOn=2019-08-29 on all Resources, use:

for n in $(az tag list [--subscription <Subscription ID>] | fgrep -w *expireOn* | fgrep -w *2019-08-29*)
do
az tag remove-value --name expireOn --value 2019-08-29
done

To Learn more how to manage tags using PowerShell and Azure CLI visit bit.ly/azureTags

Azure Subscription

If you don't own an Azure subscription already, you can create your free account today. It comes with 200$ credit, so you can experience almost everything without spending a dime.

Create your free Azure account today


Current Status, Future Features

There is a Glo board to see what's in progress and on the road map. Feel free to great issues to request new feature or if you find bugs.


Contributing

Want to contribute? Check out our Code of Conduct and Contributing docs. This project follows the all-contributors specification. Contributions of any kind welcome!

Thanks goes to these wonderful people (emoji key):


Frank Boucher

💻 📖

Christopher Sl.

📖 💻

Alex Khil

💻
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].