Giter VIP home page Giter VIP logo

azquota's Introduction

azquota

Shell scripts to fetch the quota information for the Compute, Network and Storage resources for the desired subscriptions in Microsoft Azure.

Backdrop:

The quota information is all about how much resources are allocated for a subscription and how much of those resources are being actually used. This helps one to plan their deployments.

There are in all 2 shell scripts which help to fetch the quota information as follows:
azquotaworker.sh: This is the script which does the actual work of fetching the quota information for a subscription. azquotamaster.sh: This is the script which feeds the parameters to the azquotaworker.sh and then executes it.

Only the azquotamaster.sh is to be modified with the relevant details.
azquotaworker.sh just does the work of fetching the data.
Both the shell scripts are to be copied to the same directory and are to be made executable. The quota information is generated as a .csv per subscription per region. The csv file naming will be of the format <Subscription_id>_.csv

Prerequisites:

az-cli is needed for the scripts to work -- https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest

Usage:

Step a: To use azquotamaster.sh, an Azure Active Directory service principal is to be created -- https://docs.microsoft.com/en-us/cli/azure/ad/sp?view=azure-cli-latest#az-ad-sp-create-for-rbac .
The default command for the same is:
az ad sp create-for-rbac -n "<sp_name>"

The above command gives the below output:
{ "appId": "", "displayName": "<sp_name>", "name": "http://<sp_name>", "password": "<sp_password>", "tenant": "<tenant_id>" }

Step b: Copy azquotamaster.sh and azquotaworker.sh in the same directory. Now based on the output received above, the azquotamaster.sh needs to be modified as follows:

Step b.1: Enter the regions for which the quota information is to be fetched. Example as below:
regionarr=('southeastasia' 'eastus')

Step b.2: Enter the AAD service principal details based on the output obtained in step a. Example as below:
./azquotaworker.sh "http://myspname" "my_sp_password" "tenant_id" "subscription_id" "${regionarr[@]}"

So in all the 2 lines should look as below:

regionarr=('region1' 'region2')
./azquotaworker.sh "<sp_name>" "<sp_password>" "<tenant_id>" "<subscription_id>" "${regionarr[@]}"

Repeat the above two lines with relevant details for fetching the quota information for different subscription ids.

Step c: Make both the shell scripts executable (azquotamaster.sh and azquotaworker.sh)

Step d: Execute the azquotamaster.sh script. Example below if the script is to be execute from the same folder:
./azquotamaster.sh

Step e: The quota information is generated in the .csv files. The csv file naming will be of the format <Subscription_id>_.csv

azquota's People

Contributors

saurabhvartak1982 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.