Gets the quota usage for a search SKU in the given subscription.
GET https://management.azure.com/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}?api-version=2023-11-01
URI Parameters
Name |
In |
Required |
Type |
Description |
location
|
path |
True
|
string
|
The unique location name for a Microsoft Azure geographic region.
|
skuName
|
path |
True
|
string
|
The unique SKU name that identifies a billable tier.
|
subscriptionId
|
path |
True
|
string
|
The unique identifier for a Microsoft Azure subscription. You can obtain this value from the Azure Resource Manager API, command line tools, or the portal.
|
api-version
|
query |
True
|
string
|
The API version to use for each request.
|
Name |
Required |
Type |
Description |
x-ms-client-request-id
|
|
string
uuid
|
A client-generated GUID value that identifies this request. If specified, this will be included in response information as a way to track the request.
|
Responses
Name |
Type |
Description |
200 OK
|
QuotaUsageResult
|
The operation succeeded. The response contains the quota usage of a search service SKU for the given subscription.
|
Other Status Codes
|
CloudError
|
An unexpected error occurred during the operation.
|
Security
azure_auth
Microsoft Entra ID OAuth2 authorization flow.
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
impersonate your user account
|
Examples
GetQuotaUsage
Sample request
GET https://management.azure.com/subscriptions/subid/providers/Microsoft.Search/locations/westus/usages/free?api-version=2023-11-01
from azure.identity import DefaultAzureCredential
from azure.mgmt.search import SearchManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-search
# USAGE
python get_quota_usage.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = SearchManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.usage_by_subscription_sku(
location="westus",
sku_name="free",
)
print(response)
# x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsage.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armsearch_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7e29dd59eef13ef347d09e41a63f2585be77b3ca/specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsage.json
func ExampleManagementClient_UsageBySubscriptionSKU() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armsearch.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewManagementClient().UsageBySubscriptionSKU(ctx, "westus", "free", &armsearch.SearchManagementRequestOptions{ClientRequestID: nil}, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.QuotaUsageResult = armsearch.QuotaUsageResult{
// Name: &armsearch.QuotaUsageResultName{
// LocalizedValue: to.Ptr("F - Free"),
// Value: to.Ptr("free"),
// },
// CurrentValue: to.Ptr[int32](8),
// ID: to.Ptr("/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}"),
// Limit: to.Ptr[int32](16),
// Unit: to.Ptr("Count"),
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { SearchManagementClient } = require("@azure/arm-search");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Gets the quota usage for a search sku in the given subscription.
*
* @summary Gets the quota usage for a search sku in the given subscription.
* x-ms-original-file: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsage.json
*/
async function getQuotaUsage() {
const subscriptionId = process.env["SEARCH_SUBSCRIPTION_ID"] || "subid";
const location = "westus";
const skuName = "free";
const credential = new DefaultAzureCredential();
const client = new SearchManagementClient(credential, subscriptionId);
const result = await client.usageBySubscriptionSku(location, skuName);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
using System;
using System.Threading.Tasks;
using Azure.Core;
using Azure.Identity;
using Azure.ResourceManager;
using Azure.ResourceManager.Resources;
using Azure.ResourceManager.Search;
using Azure.ResourceManager.Search.Models;
// Generated from example definition: specification/search/resource-manager/Microsoft.Search/stable/2023-11-01/examples/GetQuotaUsage.json
// this example is just showing the usage of "UsageBySubscriptionSku" operation, for the dependent resources, they will have to be created separately.
// get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
TokenCredential cred = new DefaultAzureCredential();
// authenticate your client
ArmClient client = new ArmClient(cred);
// this example assumes you already have this SubscriptionResource created on azure
// for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource
string subscriptionId = "subid";
ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
// invoke the operation
AzureLocation location = new AzureLocation("westus");
string skuName = "free";
QuotaUsageResult result = await subscriptionResource.UsageBySubscriptionSkuAsync(location, skuName);
Console.WriteLine($"Succeeded: {result}");
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample response
{
"id": "/subscriptions/{subscriptionId}/providers/Microsoft.Search/locations/{location}/usages/{skuName}",
"unit": "Count",
"currentValue": 8,
"limit": 16,
"name": {
"value": "free",
"localizedValue": "F - Free"
}
}
Definitions
Name |
Description |
CloudError
|
Contains information about an API error.
|
CloudErrorBody
|
Describes a particular API error with an error code and a message.
|
Name
|
The name of the SKU supported by Azure AI Search.
|
QuotaUsageResult
|
Describes the quota usage for a particular SKU.
|
CloudError
Contains information about an API error.
Name |
Type |
Description |
error
|
CloudErrorBody
|
Describes a particular API error with an error code and a message.
|
CloudErrorBody
Describes a particular API error with an error code and a message.
Name |
Type |
Description |
code
|
string
|
An error code that describes the error condition more precisely than an HTTP status code. Can be used to programmatically handle specific error cases.
|
details
|
CloudErrorBody[]
|
Contains nested errors that are related to this error.
|
message
|
string
|
A message that describes the error in detail and provides debugging information.
|
target
|
string
|
The target of the particular error (for example, the name of the property in error).
|
Name
The name of the SKU supported by Azure AI Search.
Name |
Type |
Description |
localizedValue
|
string
|
The localized string value for the SKU name.
|
value
|
string
|
The SKU name supported by Azure AI Search.
|
QuotaUsageResult
Describes the quota usage for a particular SKU.
Name |
Type |
Description |
currentValue
|
integer
|
The currently used up value for the particular search SKU.
|
id
|
string
|
The resource ID of the quota usage SKU endpoint for Microsoft.Search provider.
|
limit
|
integer
|
The quota limit for the particular search SKU.
|
name
|
Name
|
The name of the SKU supported by Azure AI Search.
|
unit
|
string
|
The unit of measurement for the search SKU.
|