Azure Data Factory - Scale elasticpool with web activity

160 Views Asked by At

I'm trying to scale my Azure elasticpool in datafactory with a web activity task passing the following api call:

{
    "url": "https://management.azure.com/subscriptions/subID/resourceGroups/RGNAME/providers/Microsoft.Sql/servers/sqlservername/elasticPools/elasticpoolname?api-version=2020-08-01-preview",
    "method": "PUT",
    "headers": {
        "Content-Type": "application/json"
    },
    "body": {
        "sku": {
            "name": "StandardPool",
            "tier": "Standard",
            "capacity": "50"
        },
        "location": "West Europe"
    },
    "authentication": {
        "type": "MSI",
        "resource": "https://management.azure.com/"
    }
}

The activity fails, but the strange thing is that the scale actually works. Even though the scaling works I obviously don't want the activity to fail.

ADF has a contributor role in SQLServer

Any idea?

Here is the error:

"error": {
    "code": "AuthorizationFailed",
    "message": "The client 'ADF ID' with object id 'ADF ID' does not have authorization to perform action 'Microsoft.Sql/locations/elasticPoolOperationResults/read' over scope '/subscriptions/SUBID/resourceGroups/RGNAME/providers/Microsoft.Sql/locations/westeurope/elasticPoolOperationResults/id' or the scope is invalid. If access was recently granted, please refresh your credentials."
}
1

There are 1 best solutions below

3
Vamsi Bitra On

I reproduce same my environment. I got same error.

enter image description here

To resolve this issue. Go to SQL server -> Access control (IAM) + Add Contributor role -> Go to members Assign access to Manage identity and select azure data factory.

enter image description here

Try with below body and header:

Header: Content-Type application/json

Body: {"sku":{"name":"GP_Gen5_2","tier":"GeneralPurpose"},"location":"eastus"}

Resource: https://management.azure.com/

If you want to check the configuration use below script:

script :

SELECT DATABASEPROPERTYEX(db_name(),'edition') AS ServiceTier , DATABASEPROPERTYEX(db_name(),'serviceobjective') AS ComputeSize

enter image description here