How can I set up a GitHub workflow for deploying to both test and production with AZD?

0
0
Asked By CloudyCoder42 On

I'm currently using a modified AZD pipeline generated GitHub workflow to deploy to my Azure test environment, which is working great. I've created two environments locally using `azd env new` – one for testing (aspire-test) and one for production (aspire-prod), and I can deploy to them using `azd deploy`. However, I'm struggling to update my workflow for production deployment. It seems to rely on the AZD_INITIAL_ENVIRONMENT_CONFIG that's set up during `azd pipeline config`, but this only works with the environment selected when that configuration was last run. I thought Aspire was ready for CI/CD, but it's frustrating if I can only deploy to one environment!

3 Answers

Answered By TechieTommy On

What I do is use GitHub Actions environments for deployment. You just rename your environment and it handles the rest. We have dev, test, and prod setups. The key for AZD is to adjust the variables you pass to it. Have you considered modifying your AZURE_ENV_NAME? That's usually the trick to get it working.

Answered By CloudyCoder42 On

I appreciate the input! I get stuck because `azd provision` pulls its configuration from secrets.AZD_INITIAL_ENVIRONMENT_CONFIG, which is linked to the environment set at the time. When I try to use a different environment, the deployment fails due to mismatching values. How do you guys work around that in your setups?

Answered By DevOpsDude99 On

Honestly, AZD can be a real hassle for CI/CD setups, not so much due to Aspire's capabilities. I’d recommend looking into using `dotnet publish` and managing your provisioning and infrastructure tasks manually. Trying to make AZD work without all the unnecessary complexity is like reinventing the wheel. It might be easier this way!

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.