0

I have an ASP.NET Web App that utilizes a SQL Server database with Entity Framework in Azure Data Studio, along with Docker as a container. I recently published my web app to Azure, and none of my data from my web app migrated to my published web app. I have already added a SQL Server as well in Azure.

Keep in mind I am using Visual Studio 2019 on the MAC. I have seen a tutorial online where you can select a service dependency for an azure database, but I can't find that feature on my VS. How would I go about connecting my SQL Server database to my published web app?

1 Answer 1

0

In the app service in azure portal, under configuration you can add a connection string to your sql server database

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

6 Comments

Thanks for the response! Question, how would that map with my connection string in my appsettings.json? Like in terms of the name, value, and type.
@MPagan: If you already have the connection string in your appsettings.json, there’s no need to configure it on Azure. When you request your connection string, IConfiguration will first look in appsettings.json, then in the Azure configuration values, which are relayed as environment variables.
@MPagan: That said, connection strings are frequently stored in a secrets.json instead of appsettings.json—and especially if they include potentially sensitive information that you don’t want published to e.g. your source code repository. In that case, it’s common to separately define the connection string in each developer’s secrets.json, as well as in each Azure App Service’s configuration. Same goes with other secrets, such as e.g. API keys. Alternatively, you can use Azure App Configuration to store these centrally.
@MPagan: That’s exactly right. Here’s some documentation that will aid in the import process. As an aside, I always found the term data-tier application a bit confusing, but it is in fact what you want to use. That said, I’ve never gone through the export process on Visual Studio for Mac, so YMMV.
@MPagan: At least according to this article, however, “the data-tier applications in Visual Studio can only be created on Windows. There are not versions in Mac that support the development of Data-Tier Applications on macOS.”
|

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.