Code Monkey home page Code Monkey logo

remove-azure-storage-containers's Introduction

remove-azure-storage-containers 🧹

Introduction

This is a simple Python script that allows you to remove all useless containers from your Azure Storage Account

The script will list all the containers that start with a generic string and that have not been modified since a specific date. It will then ask you if you want to remove them.

Idea

The idea behind this is to remove tons of Bootdiagnostics containers that were generated by Azure VMs at every startup.

How to use

  1. Edit the following variables in the remove_old_blobs.py file:
    • CONTAINER_NAME_STARTS_WITH : The beggining of the name of your containers to mass-remove (e.g. "bootdiagnostics-")
    • LAST_EDIT_DATE : The most recent edit date of the containers you wish to remove (e.g. "2024-31-01")
  2. Set the BLOB_CONNECTION_STRING environment variable
    echo "Enter your Connection String then press Enter..." && read -s secret && export BLOB_CONNECTION_STRING=$secret
    The Connection String starts with "DefaultEndpointsProtocol=https......" It can be found in the Azure Portal under the Access keys section of your Azure Storage Account
  3. Install the required packages:
    pip install requirements.txt
  4. Run the script:
    python remove_old_blobs.py
  5. Enter "yes" to remove the containers that are listed in the console and on the "output.txt" file.

Disclaimer

If you fork this repo, please make sure to remove the Connection String variable as it can be used maliciously.

remove-azure-storage-containers's People

Contributors

timothechauvet avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.