An Azure service that provides streamlined full-stack web app development.
Hi,
Q: Is there any way that I can connect the static web app and backend? I have tried using the environment variables, and github secrets, but it seems that they cannot communicate
A: One way to link your Static Web App (SWA) to your backend is to use the built-in capability to proxy requests to /api to your app service. SWA Environment variables are for managed functions (which you aren't using). For reference:
API support in Azure Static Web Apps with Azure App Service
https://learn.microsoft.com/en-us/azure/static-web-apps/apis-app-service
Basic instructions to link to your backend are below:
Navigate to your static web app in portal, on left, click on Settings -- Hosting Plan. Select Standard and click Save.
Click on Settings -- APIs. Click on Link next to Production.
Select Web App, select your Subscription, select your app service, select slot, click Link, similar to below screenshot:
Q: Right now when developing, I can connect the backend with the db and storage account, in the production, it is okay to use environment variable right?
A: Yes, it is okay to use environment variables. In your case you are using them in your app service. You may consider storing sensitive variables in key vault (from your diagram it appears you may already doing this).
Please click Accept Answer and upvote if the above was useful.
Thanks.
-TP