Skip to content

Console app to migrate MSSQL export into Azure Cosmos DB and containerized Blazor server app to browse the new database and create excel exports. The apps and cloud resources are automatically deployed via Azure DevOps Pipeline CI.

License

Notifications You must be signed in to change notification settings

Better-Computing-Consulting/mssql-cosmosdb-migrator-blazorapp-dbrowser-ci-deployment

Repository files navigation

mssql-cosmosdb-migrator-blazorapp-dbrowser-ci-deployment

Console app to migrate MSSQL export into Azure Cosmos DB and containerized Blazor server app to browse the new database and create excel exports. The apps are automatically deployed via Azure DevOps Pipeline CI.

Technologies used in this project:

  • ASP.NET Core 6.0, C# 10, Blazor Application using minimal hosting model
  • .NET to JavaScript streaming via DotNetStreamReference
  • .Net 6 Core Console Application

Azure Resources:

  • Cosmos DB
  • Container Registry
  • Container Instance with environment variables and managed identity.
  • KeyVault

NuGet Packages:

  • Microsoft.Azure.Cosmos
  • Azure.Identity
  • Azure.Extensions.AspNetCore.Configuration.Secrets
  • NPOI

Automatic deployment of Azure DevOps Project, Service Endpoints, and Pipeline.

Steps to reproduce:

  1. Setup the DevOps project by running the setdevopsproj.sh script. Update the script variables to fit your environment. This script requires the extension azure-devops, will run completely unattended if you set the AZURE_DEVOPS_EXT_GITHUB_PAT variable before running the script or by entering the GitHub Pat in the script and uncommenting this line:

       #export AZURE_DEVOPS_EXT_GITHUB_PAT=enter-github-pat-here

       The setdevopsproj.sh script creates a DevOps project, two Service Endpoints (one for Azure, another for GitHub) and a Pipeline.

  1. Clone your copy of the repository onto a computer running Microsoft SQL Server.

  2. Execute the PowerShell SQLRestoreExport.ps1 script from the .\dbmigrate\Files directory. This script does the following:

  3. Commit the new report files.

Committing the report files will trigger the execution of the pipeline.

The pipeline will:

  1. Make sure all the Azure resources are in place,
  2. compile the dbmigrate console program and import the MSSQL reports into CosmosDB,
  3. compile the cosmosdbviewer Blazor application,
  4. upload its container to the Container Registry, and
  5. create a container instance from the image.

This blog details each step and some of the features of dbmigrate and comsosdbviewer programs, including how to authenticate using the managed identity of the application container instance to an Azure KeyVault to retrieve the Cosmos DB connection string.

https://bcc.bz/post/mssql-to-cosmos-db-migrator-and-containerized-blazor-app-azure-devops-ci-deployment

There is also a YouTube 8 minute video that demonstrates an entire run of the process.

https://youtu.be/1lPo-VdEB1o

Enjoy

😃

About

Console app to migrate MSSQL export into Azure Cosmos DB and containerized Blazor server app to browse the new database and create excel exports. The apps and cloud resources are automatically deployed via Azure DevOps Pipeline CI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published