Azure Static Web Apps were launched earlier in 2021 and out of the box they had the capability to integrate your existing repository and deploy your Static Web App from Azure DevOps. You can reference the full getting started guide for the end-to-end deployment setup. Although, there is a caveat, the whole process is not entirely automated. When you create an Azure Static Web App you are required to copy the Deployment Token from the Azure portal into your variables in Azure DevOps.
While deployment using Azure DevOps is supported, we really want to be better automate our pipeline and take out the manual intervention of having to copy and paste our Deployment Token into our pipelines. The reality is, we are going to need to rotate our deployment token to maintain a highly secure application. Imagine if we were taking part in good security practices and rotated our tokens, but forgot that we had a manual step to update our pipeline variables? This would undoubtedly cause downtime in our Azure Static Web App.
In our pipeline we can create a task that runs a PowerShell script that pulls the latest Deployment token from the Azure portal, then updating our pipeline deployment token with the new token value. This automates what would have been a very manual process!
Here is a sample pipeline that includes this automation task:
If you would like to reuse this task (please send a very warm thank you to Steven Murawski) and you can reference the PowerShell script here.
Good luck and happy automating!
For more DevOps goodness have a look at the links below:
The DevOps Lab on YouTube
The DevOps Lab on Twitter
The DevOps Lab on Microsoft Docs
Useful Docs:
Microsoft Azure: $200 Free Credit
Azure DevOps Hands on Labs
Get started with the Azure DevOps learning path
Azure DevOps Documentation
I am seeing many Developers article of Microsoft DevOPS And Web Apps but your writing skills just amazing April.
– 1Fid
thank you about this great content , waiting for next release
Tehranborj
This is what I exactly need appreciating for sharing.
imgsin