question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[QUERY] Unable to access usages api via the Azure.ResourceManager.Quota SDK

See original GitHub issue

Library name and version

Azure.ResourceManager.Quota 1.0.0-beta.3

Query/Question

Hello,

when I try to access the usages api as described here: Usages- Get I get errors like this:

Message: 
Azure.RequestFailedException : The resource type 'usages' could not be found in the namespace 'Microsoft.Quota' for api version '2023-02-01'. The supported api-versions are '2021-03-15-preview'.
Status: 404 (Not Found)
ErrorCode: InvalidResourceType

Content:
{"error":{"code":"InvalidResourceType","message":"The resource type 'usages' could not be found in the namespace 'Microsoft.Quota' for api version '2023-02-01'. The supported api-versions are '2021-03-15-preview'."}}

How can I set an api version since it is automatically defaulting to a newer one?

Is the usages api deprecrated? I am not able to find this information anywhere.

I am using the code snippet thats provided in the sample:

string scope = $"/subscriptions/{SubscriptionId}/providers/Microsoft.Compute/locations/{Region}";
            ResourceIdentifier currentUsagesBaseResourceId = CurrentUsagesBaseResource.CreateResourceIdentifier(scope, resourceName);
            CurrentUsagesBaseResource currentUsagesBase = ArmClient.GetCurrentUsagesBaseResource(currentUsagesBaseResourceId);

            // invoke the operation
            CurrentUsagesBaseResource result = await currentUsagesBase.GetAsync();

Environment

.NET SDK: Version: 7.0.203 Commit: 5b005c19f5

Runtime Environment: OS Name: Windows OS Version: 10.0.22621 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\7.0.203\

Host: Version: 7.0.5 Architecture: x64 Commit: 8042d61b17

.NET SDKs installed: 3.0.103 [C:\Program Files\dotnet\sdk] 6.0.408 [C:\Program Files\dotnet\sdk] 7.0.203 [C:\Program Files\dotnet\sdk] 7.0.300-preview.23122.5 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.16 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.3 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

Issue Analytics

  • State:closed
  • Created 4 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
HarveyLinkcommented, Jun 12, 2023

Hi, @aditigaur4 , Thank you for using Azure SDK for .NET. This issue is a service issue, looks like the API version is not ready for public ARM. We could provide you a work around, you could manually set the api version until service team fix this issue:

var options = new ArmClientOptions();
options.SetApiVersion(new ResourceType("Microsoft.Quota/usages"), "2021-03-15-preview");
var client = new ArmClient(new DefaultAzureCredential(), subscription, options);
var sub = await client.GetDefaultSubscriptionAsync();
var scope = new ResourceIdentifier(sub.Id + "/providers/Microsoft.Compute/locations/eastus");
var usage = await client.GetCurrentUsagesBases(scope).GetAsync("foo");
0reactions
github-actions[bot]commented, Jun 19, 2023

Hi @aditigaur4, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot errors using Azure Resource Graph
Learn how to troubleshoot issues with the various SDKs while querying Azure resources with Azure Resource Graph.
Read more >
Usages - Get - REST API (Azure Quota)
If a {resourceName} is added after /quotas , then it's the target Azure resource URI in the GET operation for the specific resource....
Read more >
Quota - Get - REST API (Azure Reserved VM Instances)
Get the current quota (service limit) and usage of a resource. You can use the response from the GET operation to submit quota...
Read more >
Quota Request Status - List - REST API (Azure Quota)
For the specified scope, get the current quota requests for a one year period ending at the time is made. Use the oData...
Read more >
Get - REST API (Azure Quota)
Get the quota limit of a resource. The response can be used to determine the remaining quota to calculate a new quota limit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found