Passing adal configuration dynamically to Azure DevOps release pipelines

I have a .net core SPA application that I integrated with Azure AD using the ADAL library. I have the ADAL configuration (Client ID, tenant ID etc.) within the app.module.ts file and they are currently pointing to the local development environment values.

I am using Azure DevOps to build and deploy the application. I have an Azure build pipeline to build and publish the artifact at the end of the CI cycle and I have a release pipeline to take the artifact and deploy it to a QA environment (windows VM) using the IIS Web Deploy Task.

The release pipeline successfully deploys the application to the VM but it still uses the old development values for ADAL configuration and hence the authentication doesn’t work on the QA server.

I know I could use the environment.ts file(s) to pass the ADAL configuration dynamically based on the environment that I am deploying to but the problem is the publish artifact task of the build pipeline by default uses the ‘–prod’ parameter to build the artifact (.zip) that I am using to deploy to QA which means it is going to always use the environment.prod.ts file irrespective of the environment that I am deploying to.

My idea is to build the artifact once at the end of the CI phase and deploy the same artifact to any higher environments. How do I achieve that with .net Core + Angular 7 + MSAdalAngular6 + Azure DevOps?

Thanks!

Source: Angular

Leave a Reply

Your email address will not be published. Required fields are marked *

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