0

How to create U-SQL Data Source with connection string ?

This is my attempt, it has issue in setting the CREDENTIAL parameter.

CREATE DATA SOURCE MyAzureSQLDBDataSource
FROM AZURESQLDB
WITH
(
    PROVIDER_STRING = "Database=mySampleDB;",
    CREDENTIAL = "Server=mySampleDB.database.windows.net;User ID=myUser;Password=myPasswd",
    REMOTABLE_TYPES = (bool, byte, sbyte, short, ushort, int, uint, long, ulong, decimal, float, double, string, DateTime)
);

Error message:

error External0: E_CSC_USER_INVALIDDATASOURCEOPTIONVALUE: Invalid value '"Server=mySampleDB.database.windows.net;User ID=myUser;Password=myPasswd"' for data source option 'CREDENTIAL'.
Description:
The only valid values for 'CREDENTIAL' are identifiers or two-part identifiers.
Resolution:
Use a valid value.

2 Answers 2

2

Have you reviewed CREATE DATA SOURCE (U-SQL)?

Sign up to request clarification or add additional context in comments.

2 Comments

I did. This documentation does not explain about creating data source from connection string.
Look at the example. The documentation clearly states that you have to create the credential (which contains the connection string) outside of the U-SQL script.
1

To expand on David's answer.

Since U-SQL scripts are stored at least temporarily in the cluster, we cannot allow the inclusion of secrets in the script. Instead, you need to create the credential in the metadata via an Azure PowerShell command (or SDK) and then refer to that credential in the CREATE DATA SOURCE statement. The documentation link provided by David contains some examples.

6 Comments

Is there a way to create the credential from csharp ?
There is a way to use the ADLA SDK to create the credential (learn.microsoft.com/en-us/azure/data-lake-analytics/…). Note that this has to be run outside of a U-SQL script since it does not allow accessing REST end points.
Argh, the CREATE CREDENTIAL statement is deprecated.. msdn.microsoft.com/en-us/azure/data-lake-analytics/u-sql/…
Is there an example for creating DATA SOURCE with ADO.NET ?
If PROVIDER_STRING fully accepts ADO.NET connection string, and CREDENTIAL parameter optional, Azure DataLake will become a very powerful ETL tool. msdn.microsoft.com/en-us/azure/data-lake-analytics/u-sql/…
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.