'Get accesstoken using AzureServiceTokenProvider in SSIS script task deployed to Azure Data Factory SSIS IR
I am trying to invoke an Azure Rest API from SSIS script task. I need a bearer token to authenticate the request. I am using AzureServiceTokenProvider to get the access token.
AzureServiceTokenProvider azureServiceTokenProvider = new AzureServiceTokenProvider();
string accessToken =
azureServiceTokenProvider.GetAccessTokenAsync("https://management.azure.com/").Result;
This code worked and I was able to get the token from Visual studio. However, it fails when the package is deployed to Azure SSISDB IR.
The error message is as below:
Parameters: Connection String: [No connection string specified], Resource:
https://vault.azure.net, Authority: https://management.azure.com/, Authority: . Exception
Message: Tried the following 3 methods to get an access token, but none of them worked.
Parameters: Connection String: [No connection string specified], Resource:
https://vault.azure.net, Authority: https://management.azure.com/, Authority: . Exception
Message: Tried to get token using Managed Service Identity. Unable to connect to the
instance Metadata Service (IMDS).
Skipping request to the Managed Service Identity (MSI) token endpoint.
I have the managed identity created and configured on the Azure resources. Any inputs on resolving this error? Or is there any other way to get the bearer token?
Any help is appreciated!
Solution 1:[1]
When the AzureServiceTokenProvider attempts to retrieve a token to access the Vault using the service's Managed Identity, an error occurs.
Parameters: Connection String: [No connection string specified], Resource: https://vault.azure.net, Authority:https://management.azure.com/,
When you run your code on an Azure with a managed identity enabled, the library automatically uses the managed identity. You can use a user-assigned identity to authenticate. See About Managed Identities for Azure Resources for additional information on user-assigned identities. To authenticate with a user-assigned identity, provide the user-assigned identity's Client ID in the connection string. Connection String Support specifies the connection string.
To call an Azure Rest API from SSIS script task you can refer this How To Consume Web API Through SSIS Package
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | PratikLad-MT |
