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

[QUERY] Use arm deploy with armtemplate parameters is exception. #47326

Open
FisherMS opened this issue Nov 26, 2024 · 2 comments
Open

[QUERY] Use arm deploy with armtemplate parameters is exception. #47326

FisherMS opened this issue Nov 26, 2024 · 2 comments
Assignees
Labels
ARM 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

Comments

@FisherMS
Copy link

Library name and version

Azure.ResourceManager.Resources 1.9.0

Query/Question

here is the parameter json file.

{
    "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
    "contentVersion": "1.0.0.0",
    "parameters": {
    }
}

C# code point:

 var txtTemplate = await File.ReadAllTextAsync(templateFile);
var properties = new ArmDeploymentProperties(ArmDeploymentMode.Incremental)
{
    Template = BinaryData.FromString(txtTemplate)
    Parameters = BinaryData.FromString(txtParameter);
};

exception:

Azure.RequestFailedException: The request content was invalid and could not be deserialized: 'Error converting value "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#" to type 'Azure.Deployments.Core.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.$schema', line 1, position 2412.'.
Status: 400 (Bad Request)
ErrorCode: InvalidRequestContent

Content:
{"error":{"code":"InvalidRequestContent","message":"The request content was invalid and could not be deserialized: 'Error converting value \"https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#\" to type 'Azure.Deployments.Core.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.$schema', line 1, position 2412.'."}}

Headers:
Cache-Control: no-cache
Pragma: no-cache
x-ms-failure-cause: REDACTED
x-ms-ratelimit-remaining-subscription-writes: REDACTED
x-ms-ratelimit-remaining-subscription-global-writes: REDACTED
x-ms-request-id: 2e6812d4-a331-42c4-8522-0d99f2d86055
x-ms-correlation-request-id: REDACTED
x-ms-routing-request-id: REDACTED
Strict-Transport-Security: REDACTED
X-Content-Type-Options: REDACTED
X-Cache: REDACTED
X-MSEdge-Ref: REDACTED
Date: Tue, 26 Nov 2024 02:51:12 GMT
Content-Length: 366
Content-Type: application/json; charset=utf-8
Expires: -1

   at Azure.Core.OperationInternal`1.GetResponseFromState(OperationState`1 state)
   at Azure.Core.OperationInternal`1.UpdateStatusAsync(Boolean async, CancellationToken cancellationToken)
   at Azure.Core.OperationInternalBase.UpdateStatusAsync(CancellationToken cancellationToken)
   at Azure.Core.OperationPoller.WaitForCompletionAsync(Boolean async, OperationInternalBase operation, Nullable`1 delayHint, CancellationToken cancellationToken)
   at Azure.Core.OperationInternalBase.WaitForCompletionResponseAsync(Boolean async, Nullable`1 pollingInterval, String scopeName, CancellationToken cancellationToken)
   at Azure.Core.OperationInternal`1.WaitForCompletionAsync(Boolean async, Nullable`1 pollingInterval, CancellationToken cancellationToken)
   at Azure.Core.OperationInternal`1.WaitForCompletionAsync(CancellationToken cancellationToken)
   at Azure.ResourceManager.Resources.ArmDeploymentResource.ValidateAsync(WaitUntil waitUntil, ArmDeploymentContent content, CancellationToken cancellationToken)
   at Aicro.AzureDeploy.Services.DefaultArmTemplateDeployProvider.ValidDeployArmTemplateAsync

Environment

dotnet8 VS2022

@github-actions github-actions bot added customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Nov 26, 2024
@jsquire jsquire added ARM 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 and removed needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. labels Nov 26, 2024
@jsquire
Copy link
Member

jsquire commented Nov 26, 2024

Thank you for your feedback. Tagging and routing to the team member best able to assist.

@FisherMS
Copy link
Author

I currently use the method of reading the parameter file content first, then deserializing it into an object, and then converting it into a NameValue pair of JsonObject to complete the parameter reading.
Then call BinaryData.FromObjectAsJson(pmJsonObj) ok.

This is a workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ARM 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
Projects
None yet
Development

No branches or pull requests

3 participants