1

I would like to transfer data from Azure Blob to Azure SQL Database using Azure Data Factory. I found this link : Copy data from Azure Blob to Azure SQL Database using Azure Data Factory

EDIT : I need to connect to my Azure Subscription to create a Data Factory and a Pipe line.

My problem is to find value for "authenticationKey".

string authenticationKey = "<your authentication key for the application>";

I need to create a "ClientCredential" like below code :

// Authenticate and create a data factory management client
var context = new AuthenticationContext("https://login.windows.net/" + tenantID);
ClientCredential cc = new ClientCredential(applicationId, authenticationKey);
AuthenticationResult result = 
context.AcquireTokenAsync("https://management.azure.com/", cc).Result;
ServiceClientCredentials cred = new TokenCredentials(result.AccessToken);
var client = new DataFactoryManagementClient(cred) { SubscriptionId = subscriptionId };

you can see in below image my application registration in azure.

enter image description here

Ardalan Shahgholi
  • 11,967
  • 21
  • 108
  • 144
  • Use a windows explorer and see if you can get to : ~https://login.windows.net/TenantID". – jdweng Sep 11 '19 at 15:42
  • @jdweng I did it on Google chrome. this is my result : This login.windows.net page can’t be foundNo webpage was found for the web address: https://login.windows.net/23........ – Ardalan Shahgholi Sep 11 '19 at 15:46
  • The you need to make the folder shareable (or change credentials) so the outside world can get the key. – jdweng Sep 11 '19 at 15:49
  • @jdweng Which folder are you talking about? I need to connect to my Azure Subscription to create a Data Factory and a Pipe line. I am following the below link instructions. – Ardalan Shahgholi Sep 11 '19 at 15:53
  • The following instruction needs to get the key :var context = new AuthenticationContex(....... – jdweng Sep 11 '19 at 15:55
  • @jdweng I know it. the next line after that i have this line : ClientCredential cc = new ClientCredential(applicationId, authenticationKey); and i need to have a value for secound parameter. My question is : where can i find this value? – Ardalan Shahgholi Sep 11 '19 at 16:04
  • It is a private key that can be anything and has to be the same when creating and verifying. You don't want to make it part of the code because it can be extracted out of the executable. – jdweng Sep 11 '19 at 16:17
  • @jdweng How can i create this key in my azure portal? – Ardalan Shahgholi Sep 11 '19 at 16:43
  • See : https://docs.joyent.com/public-cloud/getting-started/ssh-keys/generating-an-ssh-key-manually/manually-generating-your-ssh-key-in-windows – jdweng Sep 11 '19 at 16:46
  • You need to register an app in Azure Active Directory and create a secret/key on it. You will then use that app's id + the secret to authenticate. For the token to work you'll also need to give the app the necessary access on data factory. – juunas Sep 11 '19 at 18:14
  • @juunas could you please give me a link or more info please? – Ardalan Shahgholi Sep 11 '19 at 18:46
  • https://learn.microsoft.com/en-us/azure-stack/operator/azure-stack-create-service-principals?view=azs-1908#manage-an-azure-ad-service-principal and https://learn.microsoft.com/en-us/azure-stack/operator/azure-stack-create-service-principals?view=azs-1908#assign-a-role – juunas Sep 11 '19 at 18:49
  • Ah, that's actually for Azure Stack, but the steps are basically the same. – juunas Sep 11 '19 at 18:50

1 Answers1

3

Basically your authentication key is the secret key of your application registered in Active directory.

Please find the details here how to retrieve your secret/authentication key here.https://stackoverflow.com/a/57849682/4111181

Anish K
  • 798
  • 4
  • 13