Thank you for sharing the details
you're absolutely right that setting a ClientType header can significantly increase your API rate limits when using the Azure Cost Management API.
Here’s how to include the ClientType
header when using the Azure Go SDK:
How to Set ClientType
in Go SDK
When creating your Cost Management client, you can pass custom headers like this:
import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/costmanagement/armcostmanagement"
)
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain credential: %v", err)
}
clientOptions := &azcore.ClientOptions{
Telemetry: azcore.TelemetryOptions{
ApplicationID: "my-custom-client-type", // This sets ClientType
},
}
client, err := armcostmanagement.NewQueryClient(subscriptionID, cred, clientOptions)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
This sets the ClientType
via the ApplicationID
field, which is used internally by Azure to identify your client and apply the appropriate rate limits.
Let me know if the issue persists after following these steps. I’ll be happy to assist further if needed.