none
ErrorCode 2108 when trying to make a POST Call to Azure SQL DWH

    Question

  • Hello, everybody!

    I am trying to use Azure Data Factory to start and stop my Azure SQL Datawarehouse at certain times every day. To do this, I created a pipeline, contain two Web Calls. First one is the POST Call to get an access token, second is the POST call to stop the DWH. Full code, see below.

    However, I always get an error at my second step:

    {
        "errorCode": "2108",
        "message": "Error calling the endpoint",
        "failureType": "UserError",
        "target": "Pause_DWH"
    }

    I have tried to use the token, which is produced in Step 1, in Postman, everything works fine here. However, I cannot get it to work in Data Factory. Is there any Firewall setting I'm missing? Or anything else in my POST-calls?

    Thank you in advance.

    Patrick

    --------------

    Code of my DF Workflow

    {
        "name": "60_Pause_DWH",
        "properties": {
            "activities": [
                {
                    "name": "Login",
                    "type": "WebActivity",
                    "policy": {
                        "timeout": "7.00:00:00",
                        "retry": 0,
                        "retryIntervalInSeconds": 30,
                        "secureOutput": false
                    },
                    "typeProperties": {
                        "url": {
                            "value": "@concat('https://login.microsoftonline.com/',pipeline().parameters.TenantID,'/oauth2/token')",
                            "type": "Expression"
                        },
                        "method": "POST",
                        "headers": {
                            "Content-Type": "application/x-www-form-urlencoded"
                        },
                        "body": {
                            "value": "@concat('grant_type=client_credentials&resource=https://management.azure.com&client_id=',pipeline().parameters.ClientID,'&client_secret=',encodeUriComponent(pipeline().parameters.ClientSecret))",
                            "type": "Expression"
                        }
                    }
                },
                {
                    "name": "Pause_DWH",
                    "type": "WebActivity",
                    "dependsOn": [
                        {
                            "activity": "Login",
                            "dependencyConditions": [
                                "Succeeded"
                            ]
                        }
                    ],
                    "policy": {
                        "timeout": "7.00:00:00",
                        "retry": 0,
                        "retryIntervalInSeconds": 30,
                        "secureOutput": false,
                        "secureInput": false
                    },
                    "typeProperties": {
                        "url": "https://management.azure.com/subscriptions/[...]/resourceGroups/[...]/providers/Microsoft.Sql/servers/[...]/databases/devsdwsmanalytics/pause?api-version=2017-10-01-preview",
                        "method": "POST",
                        "headers": {
                            "Authorization": "@concat(string(activity('Login').output.token_type),' ',string(activity('Login').output.access_token))",
                            "Content-type": "application/json"
                        }
                    }
                }
            ],
            "parameters": {
                "TenantID": {
                    "type": "String",
                    "defaultValue": ""
                },
                "ClientID": {
                    "type": "String",
                    "defaultValue": ""
                },
                "ClientSecret": {
                    "type": "String",
                    "defaultValue": ""
                },
                "SubscriptionID": {
                    "type": "String",
                    "defaultValue": ""
                },
                "Server": {
                    "type": "String",
                    "defaultValue": ""
                },
                "DatabaseName": {
                    "type": "String",
                    "defaultValue": ""
                },
                "ResourceGroup": {
                    "type": "String",
                    "defaultValue": ""
                }
            },
            "folder": {
                "name": "04_Manage_DWH"
            }
        }
    }

    Friday, August 31, 2018 10:46 AM

Answers

  • Thank you for the answer.

    I found the solution in the meanwhile, maybe it helps others.

    In the body of the Login-Call, you have to change the resource to https://management.core.windows.net/

    Friday, August 31, 2018 1:26 PM

All replies

  • Are you using ADF UI? Have you tried to use the debug feature to see whether the first activity got the right token? 

    And you could also use the UI to see the input of the second activity. 

    Friday, August 31, 2018 12:08 PM
  • Thank you for the answer.

    I found the solution in the meanwhile, maybe it helps others.

    In the body of the Login-Call, you have to change the resource to https://management.core.windows.net/

    Friday, August 31, 2018 1:26 PM