Loading...

Automating Migration from SQL Server Authentication to OAuth for Tabular Models: A Python Solution

Automating Migration from SQL Server Authentication to OAuth for Tabular Models: A Python Solution

Introduction: The transition from SQL Server Authentication (SSA) to OAuth for our tabular modernization journey required changes in our legacy tabular models. These models used SQL queries in import tables, which are now required to be changed to M queries to implement OAuth authentication. This paper discusses the challenges faced during this migration and presents a Python script as a solution to automate the conversion process.

Background: Tabular models are structured as BIM files containing various elements like data sources, measures, relationships, dimensions, queries, and roles in a nested JSON format. Changing the data sources from SQL server auth (SSA) which requires hardcoded username and passwords to OAuth which works on AAD required us to change various import statements from SQL to M compatible code as plain SQL is not supported in OAuth.  Converting the SQL queries to M queries manually within this nested JSON structure is laborious and prone to errors.

Solution: To address this issue, we developed a Python script that utilizes JSON libraries to parse the BIM files and employs an intelligent iterator to locate and modify legacy SQL queries to M queries automatically. The script operates in two phases: Phase-1 creates M queries for all objects, and Phase-2 replaces old elements in the BIM File's nested JSON with new M query elements while eliminating unnecessary ones. The result is a BIM file compliant with OAuth authentication.

Benefits: Using our Python script eliminates the need for manual intervention, significantly reducing the chances of errors. The script has been successfully employed to migrate all our legacy tabular models, ensuring its reliability and effectiveness. In a large model with 64 tables, the manual migration process would take approximately 7 days and with 7 such models it can go up to 20-30 days. However, with our script, this task can be completed in a matter of seconds, resulting in a considerable reduction in time and effort.

Conclusion: Our customized Python script proved to be a valuable solution for our migration needs. This script holds the potential to serve as a migration tool for a seamless transition from SQL Server Authentication to OAuth for your tabular models.

Code Base: Please clone this Git repo and start using the script for your migration needs.

Published on:

Learn more
Azure Migration and Modernization Blog articles
Azure Migration and Modernization Blog articles

Azure Migration and Modernization Blog articles

Share post:

Related posts

VMware HCX Design with Azure VMware Solution

Overview VMware HCX is one of the Azure VMware Solution components that generates a large number of service requests from our customers. The A...

1 year ago

Azure Backup and DR: Cross-Region Restore - Exploring Solutions

Azure Backup and DR: Cross-Region Restore - Exploring Solutions   When building a Disaster Recovery (DR) plan, customers often face chall...

1 year ago

Microsoft is headed to VMware Explore 2024 in Barcelona!

  Microsoft is headed to VMware Explore 2024 in Barcelona! If you want to know about running VCF Private Clouds in Azure, the work we ar...

1 year ago

IBM Power Virtual Server and Microsoft Azure Multi-cloud Integration Patterns

 IBM Power Virtual Server and Microsoft Azure Multi-cloud Integration Patterns               &nbs...

1 year ago

Enhancing Disaster Recovery and Ransomware Protection with Azure VMware Solution and JetStream

  Enhancing Disaster Recovery and Ransomware Protection with Azure VMware Solution and JetStream Software   Disaster Recovery (DR) ...

1 year ago

Microsoft is headed to VMware Explore 2024 in Las Vegas

  If you want to know about Azure, the work we are doing in partnership with VMware by Broadcom, or have a conversation about your VMwar...

2 years ago

Azure VMware Solution using a public IP down to the NSX-T Edge; configure SNAT, No-SNAT & DNAT

Azure VMware Solution How To Series: Configuring NSX-T SNAT, No-SNAT & DNAT rules   Overview Requirements Lab Environment NAT Rules K...

2 years ago

Azure VMware Solution now available in India Central

Azure VMware Solution has expanded its reach and is now available in India Central, marking it as the 33rd Azure region where this particular ...

2 years ago

Azure Migrate - Build 2024 Announcements

Microsoft Build introduced exciting new announcements for Azure Migrate. Cost optimization remains a top priority for customers when selecting...

2 years ago

Azure VMware Solution - Using Log Analytics With NSX-T Firewall Logs

Azure VMware Solution How To Series: Monitoring Azure VMware Solution   Overview Requirements Lab Environment Tagging & Groups Kusto ...

2 years ago

Newsletter

Get the latest Dynamics 365 and Power Platform content in your inbox

A curated digest of community blogs, product news, videos, and podcasts — delivered without the noise.

Weekly updates Unsubscribe anytime Fresh community picks
We use your email only for the newsletter and you can unsubscribe at any time.
By subscribing, you agree to the privacy policy.