Search code examples
azureazure-storageazure-blob-storageazure-table-storageazure-storage-queues

How to check azure storage availability through SDK or Rest API?


In my application im trying to get the metrics of azure storage i.e metrics for each of its services(blob,queue,file,table) but before trying to get the metrics i want to check the availability of the storage ,can i do that please suggest.

i want to check if the storage status if its up or down before collecting metrics via SDK


Solution

  • According to your description, I suggest you could send the request to management.azure.com to get your storage account current status by using rest api.

    The request is as below:

    Get Method:

    https://management.azure.com/subscriptions/{yoursubscriptionsID}/resourceGroups/{resourceGroupname}/providers/Microsoft.Storage/storageAccounts/{Youraccount name}?api-version=2017-06-01
    

    Request header:

    authorization: Bearer {accesstoken}
    

    More details about how to get the access token(Register your client application with Azure AD, Acquire an access token), you could refer to this article.

    Result:

    Notice: it will return a json which contains all your storage account current message.

    In this json message it contains the statusofPrimary property, this is the status.

    Result:

    enter image description here