Forum Discussion
corsair
Nov 18, 2024Copper Contributor
Publishing blazor web app with an sql db on azure
Hi, I have recently attempted to publish my blazor web app on azure however the webpage comes with and error : HTTP Error 500.30 - ASP.NET Core app failed to start After checking the web apps Ava...
kyazaferr
Nov 19, 2024MCT
Azure Web Apps use App Settings to configure environment variables like connection strings. Ensure your SQL connection string is correctly set there:
- Go to the Azure Portal.
- Navigate to your App Service > Configuration > Application settings.
- Ensure the connection string is added under the Connection Strings section, with the proper name (e.g., DefaultConnection).
- Server=tcp:<server-name>.database.windows.net,1433;Initial Catalog=<database-name>;Persist Security Info=False;User ID=<user-id>;Password=<password>;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;
Ensure the firewall rules for your Azure SQL Database allow connections from:
- The Azure Web App service.
- In the Azure Portal, navigate to your SQL Server.
- Go to Networking > Firewall and virtual networks.
- Select Allow Azure services and resources to access this server (toggle to Yes).
- Specific IP ranges (if necessary):
- Add the outbound IP addresses of your Web App under Firewall Rules. You can find the outbound IP addresses in the App Service > Properties section.
Verify Authentication Type
- If your connection string uses an Azure Active Directory (AAD) account (e.g., aidandwaterfordgmail.onmicrosoft.com), ensure the following:
- The AAD account is added as a database user with the appropriate permissions.
- Use the Active Directory Interactive authentication type or Active Directory Password in the connection string.
- Server=tcp:<server-name>.database.windows.net,1433;Initial Catalog=<database-name>;Persist Security Info=False;User ID=<AAD-user>;Password=<password>;Authentication=Active Directory Password;
Check Application Logs for More Details
- To better understand the issue, enable detailed error logs:
- Go to your App Service in Azure.
- Navigate to Diagnostics settings > Application Logging and enable it.
- Download the logs or check the Log Stream in real time.
- Look for detailed connection errors in the logs.
- After making changes, restart your Azure App Service to ensure the updated configuration is applied.
- To better understand the issue, enable detailed error logs:
- If your connection string uses an Azure Active Directory (AAD) account (e.g., aidandwaterfordgmail.onmicrosoft.com), ensure the following: