How to override an Azure Sql connection in the Azure portal

I tried to override the connectionstring in the Azure portal using this connection:

 Server=tcp:server.database.windows.net,1433;Database=mydatabase;User ID=username@server ;Password=xxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30; 

This gives me a Keyword not supported: 'server' error, and when I tried it like:

 metadata=res://*/DataAccess.MyDataBase.csdl|res://*/DataAccess.MyDataBase.ssdl|res://*/DataAccess.MyDataBase.msl;provider=System.Data.SqlClient;provider connection string="data source=tcp:server.database.windows.net,1433;initial catalog=MyDataBase;persist security info=True;user id=username@server ;password=xxxxxx;MultipleActiveResultSets=True;App=EntityFramework"" 

It gives "Keyword not supported: 'metadata'. !!

So what is connectionstring should I write?

I also tried all types of connection strings as shown in the screenshot. enter image description here

+5
source share
4 answers

Ok, I found an answer regarding my problem, but also I understood something

The first line of the entire connection string should look like

 metadata=res://*/DataAccess.MyDataBase.csdl|res://*/DataAccess.MyDataBase.ssdl|res://*/DataAccess.MyDataBase.msl;provider=System.Data.SqlClient;provider connection string="Server=tcp:server.database.windows.net,1433;Database=MyDataBase;User ID=username@server ;Password=xxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" 

And note that the quote should be " not " Also, as Nick said, it should be Custom .

+2
source

The first connection string ('Server = ..') is used to connect directly to the database, without going through the Entity Framework.
The second connection string ('metadata = ..') is the Entity Framework connection string. If you use EF, you should mark the connection string in the Azure Management portal as "Custom" , not "SQL Database" .

+1
source

The control panel has a spot on the database panel that says "Show database connection strings" that give you full connection strings for your database for ADO.Net, PHP, Java, and ODBC. They can be used as a starting point from which I added support for MARS and another user / password for mine.

Here is my connection string that will help you. We use this feature to override in the Azure WebApps control panel.

 Server=tcp:[AZURE_DB_NAME].database.windows.net,1433;Database=[DATABASE_NAME];User ID=[USER_ID];Password=[PASSWORD];Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;MultipleActiveResultSets=True 

As for Drop Down, we installed it in the SQL database.

One thing that comes to mind. Have you tried using the connection string in VS debugging mode to find out what is happening? You just need to configure AzureDB to allow a remote connection with your IP address to work. This may give you some idea that your connection is correct, but something else is not working.

+1
source

I tried the solution from Mohamed Farrag, but got this error:

System.ArgumentException: keyword not supported: '.ssdl | Res: //*/dataaccess.MyDataBase.msl; the supplier.

After uninstalling DataAccess. from my connection string it worked:

 metadata=res://*/MyDataBase.csdl|res://*/MyDataBase.ssdl|res://*/MyDataBase.msl;provider=System.Data.SqlClient;provider connection string="Server=tcp:server.database.windows.net,1433;Database=MyDataBase;User ID=username@server ;Password=xxxxxx;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;" 
0
source

All Articles