Header error when resizing Azure Batch pool via REST API using Data Factory

Andris Veidemanis 55 Reputation points
2023-07-05T11:58:19.33+00:00

Hello!

Issue - when running web activity in Azure Data Factory to resize Azure Batch pool I get an error:

{
  "odata.metadata": "https://batchadftest.westeurope.batch.azure.com/$metadata#Microsoft.Azure.Batch.Protocol.Entities.Container.errors/@Element",
  "code": "InvalidHeaderValue",
  "message": {
    "lang": "en-US",
    "value": "The value for one of the HTTP headers is not in the correct format.\nRequestId:429d00fe-d303-4cd1-b098-3a5961cc4d3e\nTime:2023-07-05T11:32:00.9887056Z"
  },
  "values": [
    {
      "key": "HeaderName",
      "value": "Content-Type"
    },
    {
      "key": "HeaderValue",
      "value": "application/json"
    }
  ]
}

Here is JSON for the activity:

{
    "name": "Resize",
    "properties": {
        "activities": [
            {
                "name": "Resize",
                "type": "WebActivity",
                "dependsOn": [],
                "policy": {
                    "timeout": "0.12:00:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "userProperties": [],
                "typeProperties": {
                    "url": "https://batchadftest.westeurope.batch.azure.com/pools/thecoolpool/resize?api-version=2023-05-01.17.0",
                    "connectVia": {
                        "referenceName": "AutoResolveIntegrationRuntime",
                        "type": "IntegrationRuntimeReference"
                    },
                    "method": "POST",
                    "body": {
                        "targetDedicatedNodes": 1,
                        "targetLowPriorityNodes": 0,
                        "resizeTimeout": "5"
                    },
                    "authentication": {
                        "type": "MSI",
                        "resource": "https://batch.core.windows.net/"
                    }
                }
            }
        ],
        "folder": {
            "name": "Batch"
        },
        "annotations": []
    }
}

The same problems occurs if I manually add header mentioned in the error message via GUI. Like so:

"headers": {
    "Content-Type": "application/json"
},

I don't have problem making GET requests to list available pools for example. With or without specifying header. Like so:

{
    "name": "List",
    "properties": {
        "activities": [
            {
                "name": "List",
                "type": "WebActivity",
                "dependsOn": [],
                "policy": {
                    "timeout": "0.12:00:00",
                    "retry": 0,
                    "retryIntervalInSeconds": 30,
                    "secureOutput": false,
                    "secureInput": false
                },
                "userProperties": [],
                "typeProperties": {
                    "url": "https://batchadftest.westeurope.batch.azure.com/pools?api-version=2023-05-01.17.0",
                    "connectVia": {
                        "referenceName": "AutoResolveIntegrationRuntime",
                        "type": "IntegrationRuntimeReference"
                    },
                    "method": "GET",
                    "headers": {
                        "Content-Type": "application/json"
                    },
                    "body": "",
                    "authentication": {
                        "type": "MSI",
                        "resource": "https://batch.core.windows.net/"
                    }
                }
            }
        ],
        "folder": {
            "name": "Batch"
        },
        "annotations": []
    }
}

Googling didn't help as well.

This https://learn.microsoft.com/en-us/rest/api/batchservice/pool/resize?tabs=HTTP is API reference I used.

Thanks!

EDIT: Typos and Formatting

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,222 questions
0 comments No comments
{count} votes

Accepted answer
  1. KranthiPakala-MSFT 46,602 Reputation points Microsoft Employee
    2023-07-26T18:05:55.56+00:00

    @Andris Veidemanis

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer .

    Error Message:

    "code": "InvalidHeaderValue",
      "message": {
        "lang": "en-US",
        "value": "The value for one of the HTTP headers is not in the correct format.\nRequestId:429d00fe-d303-4cd1-b098-3a5961cc4d3e\nTime:2023-07-05T11:32:00.9887056Z"
      },
    

    Issue:

    • When running web activity in Azure Data Factory to resize Azure Batch pool user running into above mentioned error

    Solution:

    • In order to overcome the issue, we have to pass the correct header value as below:
    "headers": {
        "Content-Type": "application/json; odata=minimalmetadata"
    },
    

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    I hope this helps!

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.


    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Andris Veidemanis 55 Reputation points
    2023-07-05T12:26:59.62+00:00

    Here is the correct header to pass:

    "headers": {
        "Content-Type": "application/json; odata=minimalmetadata"
    },
    
    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.