0

I've deployed an Azure Web App and Azure SQL Database using PowerShell. At the moment I have the following code with a dummy value that sets a sql connection string for my web app:

$connectionStrings = @{ "sqlConnection"= @{ "value"="placeholder"; "type"="3" } } 

I would like to be able to enter a proper sql connection string for my azure sql database, like the following: Server=tcp:example.database.useastcloudapi.net;Database=ExampleDB;User Id=Admin;Password=Something123!;

The issue im having is entering/referencing the variables I've created containing the sql user account, password and server FQDN into the connection string value above. Ideally, I'd like to do something like the following (I know that its incorrect but I want to reference the variables im using):

$connectionStrings = @{ "sqlConnection"= @{ "value"="Server=tcp:"[$sqlServer];"Database="[$sqlDatabase];"User Id="[$sqlUser]; "type"="3" } } 

I don't have much experience with powershell and im not a developer so I would appreciate any help or suggestions.

Thanks!

2
  • 1
    About Quoting Rules. "value"="Server=tcp:$sqlServer;Database=$sqlDatabase;User Id=$sqlUser;Password=$Password;" could work… Commented Oct 20, 2020 at 20:59
  • That worked for me but now my issue is the $sqlServer variable only returns the sql server name and not the full server name - servername.database.region.net. I used Get-AzSqlDatabaseSecureConnectionPolicy to get the full server name (ProxyDnsName) value but when I reference this new variable in the conn string it also adds 'ProxyDnsName' along with the server name. Is there a way to remove ProxyDnsName from being entered in the conn string? Commented Oct 21, 2020 at 15:18

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.