
This is a feature that Microsoft began rolling out last year and is extremely useful for understanding Dynamics and Database Structures – but the challenge with features in the Cloud is keeping up with new functionality or options that are sent to us ‘down the pipe,’ so it is good to get this knowledge shared more widely.
To that end, this article will demonstrate how to connect SQL Management Studio to a Dynamics or Power Apps cloud instance.
1. First of all, we need SQL Management Studio and we need it to be v18.4 – we can download this here: https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15
2. Open SQL Management Studio and select our way of connecting to the Cloud, in this case: Azure Active Directory – Password
3. Then supply the URL of Dynamics (minus the https://), our Username and our Password:
![clip_image002[4] clip_image002[4]](https://license.citruslime.com/cs/blogs/crmcs/clip_image0024_503AB8D0.jpg)
4. All being well, this will then open a view of the Dynamics Database in the Cloud in a familiar SQL format.
A few words of warning..
Its a lot! The SQL view is great but you will see *all* the Tables behind Dynamics which can be overwhelming! Its best to dip in and get used to the structure in small doses, similar to using the Advanced Find.
Its Read-Only! Any data we want to Create or Update must be done through the Dynamics API and so this SQL view is Read-Only.
Security – if you have sufficient rights to view the SQL view, you have ‘grandmaster’ rights and so avoid the usual security restrictions on the data.
![clip_image002[6] clip_image002[6]](https://license.citruslime.com/cs/blogs/crmcs/clip_image0026_7708CF10.jpg)
5. The massive advantage this gives us is the ability to run various SQL SELECT and JOIN statements past the core Dynamics Database.
Typically Dynamics and the Power Platform use their own Query language called FetchXml to run Select style statements – and we can see this in action in the CRM Advanced Find, and download our own FetchXml queries.
But FetchXml is nowhere near as well known as SQL, and so the ability to run commands on the Dynamics Database using standard SQL Notation is often a hugely useful feature.
6. For our client, this allowed us to dip into the different Database Tables and interrogate the Data or the Database Names of the Fields involved:

7. Will return:
![clip_image002[9] clip_image002[9]](https://license.citruslime.com/cs/blogs/crmcs/clip_image0029_72924E49.jpg)
To give us the history of Product Family Changes since the beginning of today.
This is an Entity that we’ve added into our clients CRM and gives a good peek behind the scenes for both System (built into Dynamics) or Custom (added by Apps or Service Providers) Tables added to the system.
Further Reading:
The following is the Microsoft Guide on the SQL Connector for Dynamics / Dataverse: https://docs.microsoft.com/en-us/powerapps/developer/data-platform/dataverse-sql-query
