Updating the deployment credentials for the built site from Devops to Blob Storage. This blog site has been authored in a customized manner using Jekyll and Markdown for over 7 years. Custom features include such things as image size control for a phone, Latex code, diagrams using Mermaid, simple code segments, custom layouts, email msg after repository push, build and deployment etc etc.
See Jekyll features
The site is built and deployed to Azure Blob Storage when its Azure Devops repository is updated.
The Devops pipeline needs to be updated occasionally to ensure credentialing and security protocols are current, particularly wrt the deployment of the built site from Devops to Blob Storage.

From time to time I get the following error when the pipeline runs the deploy tasks:

Error Code: [1]
Error: Azure login failed
Secret expired, update service connection at 

As a work around I created a multifaceted script to run locally that builds the site and deploys only the selected parts to Blob Storage.Azure Devops: Jekyll Deployment - Script for Direct Deployment updates V2 Latest Files Only This script has been substantially updated.

# Examples of usage:
# NB: root index.html is copied to the $web container for each
# Just build
# .\scripts\buildjekyl.ps1 -B 
# Just Backup last post
# .\scripts\buildjekyl.ps1 -U
#  Delete all backup files, with confirmation prompt
# .\scripts\buildjekyl.ps1 -CU
# Just build and upload blob(category) folder as well an index.html, cats and tags folder
# .\scripts\buildjekyl.ps1 -B -C "blog" 
# Just build and upload blob(category) folder. Use if just updating a blob in the category folder
# .\scripts\buildjekyl.ps1 -B -C "appdev"  -K -T -II
# Just uploadindex.html
# .\scripts\buildjekyl.ps1 -I
# Just build and upload cats and tags folders: -C param folder doesn't exist
# .\scripts\buildjekyl.ps1 -B -C "none" 
# Update the images folder after adding or updating an image, after building the site
# .\scripts\buildjekyl.ps1 -B -C "images"  -K -T -II
# Upload calendar ONLY
# scripts/buildjekyl -L 
...
...
...'
#

A complete copy of the latest version of the script is here: buildjekyl.ps1.txtRemove .txt extension to run as a Powershell script.

Revisiting deployment through Azure Devops …
I have blogged about this previously but this is a simpler expose’ of the steps needed to update the service connection credentials:

  • Go to the Azure Devops project page
  • Click on the Project Settings (bottom left gear icon)
  • Click on Service Connections (under Pipelines)
  • Click on [New Service Connection] … top right.
  • Select Service Connection of type Azure Resource Manager
  • Click [Next]
  • Identity type - App Registration (default)
  • Credential - Work identity federation (default)
  • As a minimum
    • Use a Subscription (default)
    • Select the appropriate Subscription
    • Give the Service Connection a name
      • By default it uses the subscription name which later on can be confusing as it seems to be the subscription that needs updating not Service Connection.
      • So suggest that you give it a unique meaningful name, eg including the date.
    • Leave other settings as blank or defaults.
  • [Save]
  • Now go to the Release Pipeline that deploys the built site to Blob Storage
  • Edit the Pipeline
    • In my case I am looking at 2 tasks:
      • Delete the Blob Storage content
      • Upload the new built site content to Blob Storage
    • In both tasks first delete the existing Service Connection.
    • Then select the new one, created above which should now appear at the bottom of the list.
  • Save the Pipeline
  • Run the Pipeline The deployment should now complete successfully. 😃

 TopicSubtopic
   
 This Category Links 
Category:Web Sites Index:Web Sites
<  Prev:   Markdown