Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ReservationQuotaResource.UpdateAsync returns InvalidDoubleEncodedRequestUri #47615

Open
qwordy opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Reservations

Comments

@qwordy
Copy link
Member

qwordy commented Dec 19, 2024

Library name and version

Azure.ResourceManager.Reservations 1.4.0

Describe the bug

ReservationQuotaResource.UpdateAsync returns InvalidDoubleEncodedRequestUri when the resource name contains space. For example, Standard NCASv3_T4 Family.

The cause is that it passes Id.Name as resource name. Id.Name is already URL encoded.

var response = await _reservationQuotaQuotaRestClient.UpdateAsync(Id.SubscriptionId, Id.Parent.Parent.Name, new AzureLocation(Id.Parent.Name), Id.Name, data, cancellationToken).ConfigureAwait(false);

Image

Expected behavior

Do not throw InvalidDoubleEncodedRequestUri error.

Actual behavior

Azure.RequestFailedException: 'The request URI 'https://management.azure.com:443/subscriptions/subid/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/westus/serviceLimits/Standard%2520NCASv3_T4%2520Family?api-version=2020-10-25' is not valid, because it contains double encoding sequence '%25'.
Status: 400 (Bad Request)
ErrorCode: InvalidDoubleEncodedRequestUri

Content:
{"error":{"code":"InvalidDoubleEncodedRequestUri","message":"The request URI 'https://management.azure.com:443/subscriptions/subid/providers/Microsoft.Capacity/resourceProviders/Microsoft.Compute/locations/westus/serviceLimits/Standard%2520NCASv3_T4%2520Family?api-version=2020-10-25' is not valid, because it contains double encoding sequence '%25'."}}

Reproduction Steps

var armClient = new ArmClient(
    new DefaultAzureCredential(),
    "subid");
var subscription = await armClient.GetDefaultSubscriptionAsync();
var quotaResponse = await subscription.GetReservationQuotaAsync(
    "Microsoft.Compute",
    "westus",
    "Standard NCASv3_T4 Family");
var quotaResource = quotaResponse.Value;
var quotaData = quotaResource.Data;
Console.WriteLine(quotaData.Properties.ResourceName.Value);
Console.WriteLine(quotaData.Properties.Limit);

quotaData.Properties.Limit += 1;

await quotaResource.UpdateAsync(
    Azure.WaitUntil.Completed,
    quotaData);

Environment

Windows 11
.NET 8

<PackageReference Include="Azure.Identity" Version="1.13.1" />
<PackageReference Include="Azure.ResourceManager" Version="1.13.0" />
<PackageReference Include="Azure.ResourceManager.Reservations" Version="1.4.0" />
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Dec 19, 2024
@ArthurMa1978 ArthurMa1978 added Mgmt This issue is related to a management-plane library. and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Dec 19, 2024
@jsquire jsquire added Reservations customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Dec 19, 2024
@mcgallan mcgallan assigned mcgallan and unassigned HarveyLink Dec 23, 2024
@mcgallan mcgallan pinned this issue Dec 24, 2024
@jsquire jsquire unpinned this issue Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Mgmt This issue is related to a management-plane library. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Reservations
Projects
None yet
Development

No branches or pull requests

5 participants