In this post, we will go through how to deploy an instance of Universal Dashboard to Azure using Azure DevOps. We will create a CI pipeline to download and stage the required modules. Then we will create a release pipeline to upload the staged files to our existing Azure Web App.

For this example, I’m using the free tier (F1) web app running on Windows.

Repository Layout

The layout of my repository looks like this.

  • dashboard.ps1
  • deploy.ps1
  • azure-pipelines.yml
  • ud-chatroom.psm1
  • ud-chatroom.psd1

The ud-chatroom module defines a single function that starts a chatroom website using the Universal Dashboard cmdlets. It also takes advantage of the Universal Dashboard Code Editor component. We will need to download both Universal Dashboard and the Code Editor component from the PowerShell Gallery during our CI.

The dashboard.ps1 script loads the three modules and starts the dashboard.

Note that within the ud-chatroom.psm1 file, we are using endpoint initialization to load all the modules at the root of the Universal Dashboard folder. This will load the Code Editor module and any other modules you put in the root directory. This avoids having to load each one individually.

Azure Pipelines CI

Our Azure DevOps CI pipeline is configured by the azure-pipelines.yml. The yml file simply starts the deploy.ps1 script and publishes the contents of the Artifact Staging Directory as pipeline artifacts.

The deploy.ps1 file is responsible for downloading the modules from the PowerShell Gallery and staging them in a manner that works when it is published as an Azure Web App. The Universal Dashboard module is moved up out of the version folder so that the Azure Web App can find the web.config at the root of the directory.

Once running this pipeline, you’ll see that the Artifacts that have been published to the job contain all three modules and the dashboard.ps1 script.

Azure Pipelines Artifacts

Azure Pipelines CD

To create a CD pipeline to release the artifacts as an Azure Web App, go to the release page and create a new pipeline with use the Azure Web App template.

Azure Web App Template

Select the artifacts from the CI pipeline to be used as the input artifacts for the CD pipeline.

Azure CD Artifact

Select the Azure Subscription, Resource Group and Web App you want to deploy the artifacts to.

Azure Web App Deployment Task

Now you should be able to create a new Release and Deploy the dashboard to your Web App. If everything goes smoothly, you’ll be able to access you dashboard via the Web App’s URL.

Universal Dashboard Running in Azure

Conclusion

In this post we went over how to setup a CI\CD pipeline for your dashboard using Azure DevOps and deploying to an Azure Web App.