-->

DEVOPSZONES

  • Recent blogs

    How to list all Azure OpenAI Models and thier quotas in a subscription

     When you start working with Azure OpenAI, things can get piled on quickly and you would find yourself in confusing state with Regions,Subscriptions,deployments,Models and their quotas. In this  blog we would try to simplify the Azure openAI quota recordkeeping for All regions and models available there. 

    As of Now Azure OpenAI is available in 10 regions. Keeping track of them manually will be time consuming affair. Hence we will try to automate that process. To automate that we need to Clone a github project called ListAzureOpenAIModels.

    $ git clone https://github.com/ssemyan/ListAzureOpenAIModels.git


    Once you clone it , go inside that folder. 


    Login to Azure.


    $ az login


    Prerequisites

    The python code makes use of a service principal (AKA App Registration) to access Azure. Before runing the sample, create (or reuse) a service principal and ensure the principal has the Cognitive Services OpenAI User role set at the subscription level. 


    Make sure you have python3 installed in your system. Inside the folder install all the python library requirements.


    $ pip3 install -r requirements.txt



    requirement install
    requirement install


    Then set the values of the client ID, tenant ID, client secret, and subscription ID in the environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET, and AZURE_SUBSCRIPTION_ID


    These can be set in setenv.sh file and then run the command: source ./setenv.sh to set the environment variables in Linux.



    Now run the python script to fetch details. The Python script to list all the available OpenAI models, associated quota, and deployments in a subscription by region. It returns the name and version of each model along with the quota available and all the deployments for that model.


    $ python3 list_models.py 


    Azure openAI Quota details
    Azure openAI Quota details

    No comments