<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Azure Archives - AzureOps</title>
	<atom:link href="https://azureops.org/articles/category/azure/feed/" rel="self" type="application/rss+xml" />
	<link>https://azureops.org/articles/category/azure/</link>
	<description>Notable things about Cloud, Data and DevOps.</description>
	<lastBuildDate>Fri, 03 Apr 2026 11:04:24 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/azureops.org/wp-content/uploads/2021/04/cropped-android-chrome-512x512-1.png?fit=32%2C32&#038;ssl=1</url>
	<title>Azure Archives - AzureOps</title>
	<link>https://azureops.org/articles/category/azure/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">190208641</site>	<item>
		<title>Compare Azure SQL Database Schema Using sqlpackage</title>
		<link>https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 10 Jan 2026 19:16:23 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=9188</guid>

					<description><![CDATA[<p>Learn how to compare two Azure SQL Database Schema effectively and generate delta scripts for seamless deployment.</p>
<p>The post <a href="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/">Compare Azure SQL Database Schema Using sqlpackage</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">When working with Azure SQL Databases, it is quite common to have multiple environments such as <strong>Dev</strong>, <strong>Test</strong>, <strong>UAT</strong>, and <strong>Production</strong>. Over time, schema drift between these environments becomes inevitable. Before deploying changes to production, it is critical to understand <em>exactly</em> what is different and what will change.</p>



<p class="">In this article, we will see how to <strong>compare Azure SQL database schema using <code>sqlpackage.exe</code></strong> and generate a <strong>delta script</strong> that shows the differences in a controlled and repeatable way. The approach and flow are similar to the DACPAC-based comparison strategy discussed earlier on AzureOps.</p>



<h2 class="wp-block-heading">Why use sqlpackage for database comparison?</h2>



<p class=""><code><a href="https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage?view=sql-server-ver17" target="_blank" rel="noreferrer noopener">sqlpackage.exe</a></code> is a command-line utility provided by Microsoft that works with <strong>DACPAC</strong> and <strong>BACPAC</strong> files. Using <code>sqlpackage</code>, you can:</p>



<ul class="wp-block-list">
<li class="">Compare two databases using DACPACs</li>



<li class="">Generate a deployment (delta) script</li>



<li class="">Control destructive changes explicitly</li>



<li class="">Automate comparisons in CI/CD pipelines</li>
</ul>



<p class="">For Azure SQL Database scenarios, this method is especially useful when direct schema comparison tools are not available or when automation is required.</p>



<h2 class="wp-block-heading">Creating a DACPAC</h2>



<p class="">To compare database schemas using <code>sqlpackage</code>, you first need a <strong>DACPAC</strong> file, which represents the database schema.</p>



<p class="">You can create a DACPAC using <strong>sqlpackage.exe</strong>, <strong>SSMS</strong>, or <strong>Visual Studio</strong>. For a quick, step-by-step guide covering all methods, refer to this <a href="https://azureops.org/articles/dacpac-sql-server-database/?utm_source=chatgpt.com" target="_blank" rel="noreferrer noopener">article</a>.</p>



<h2 class="wp-block-heading">Installing <code>sqlpackage</code> Before You Begin</h2>



<p class="">Before you can compare two Azure SQL database schemas using <code>sqlpackage</code>, you need to <strong>install the <code>sqlpackage</code> command-line utility</strong> on your machine. <code>sqlpackage.exe</code> is the same tool that Powers the DACPAC deployments discussed in this site’s previous article on deploying DACPACs to Azure SQL Database.</p>



<p class="">Here are the recommended ways to install <code>sqlpackage</code>, depending on your environment:</p>



<h3 class="wp-block-heading">Option 1 — Install as a .NET Global Tool (Cross-Platform)</h3>



<p class="">The easiest and most modern way to install <code>sqlpackage</code> on <strong>Windows, macOS, or Linux</strong> is using the <strong>.NET SDK tool installer</strong>. This gives you the <code>sqlpackage</code> command directly on your PATH. Run below command in command prompt.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; gutter: false; title: ; notranslate">
dotnet tool install --global Microsoft.SqlPackage
</pre></div>


<p class="">If you already have it installed and want to update to the latest version, run:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: bash; gutter: false; title: ; notranslate">
dotnet tool update --global Microsoft.SqlPackage
</pre></div>


<p class="">This method works well for local development and automation scripts, including PowerShell and CI/CD pipelines.</p>



<h3 class="wp-block-heading">Option 2 — Download Standalone Zip (Windows / macOS / Linux)</h3>



<p class="">If you don’t use the .NET SDK or prefer a <strong>self-contained download</strong>, Microsoft also publishes standalone builds of <code>sqlpackage</code>:</p>



<ol class="wp-block-list">
<li class="">Visit the official SqlPackage<a href="https://learn.microsoft.com/en-us/sql/tools/sqlpackage/sqlpackage-download?view=sql-server-ver17" target="_blank" rel="noreferrer noopener"> download page</a> on Microsoft Docs.</li>



<li class="">Download the appropriate zip for your OS.</li>



<li class="">Extract and place the folder somewhere on your system (e.g., <code>C:\tools\sqlpackage</code>).</li>



<li class="">Add the folder containing <code>sqlpackage.exe</code> to your system PATH so you can call it from any terminal.</li>
</ol>



<p class="">This method is useful if you want to avoid installing .NET tools or need to bundle <code>sqlpackage</code> with deployment scripts.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?ssl=1"><img fetchpriority="high" decoding="async" width="1090" height="420" data-attachment-id="9206" data-permalink="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/image-46/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" data-orig-size="1090,420" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?fit=1090%2C420&amp;ssl=1" alt="compare Azure SQL Database Schema" class="wp-image-9206" style="width:809px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?w=1090&amp;ssl=1 1090w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=300%2C116&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=768%2C296&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=450%2C173&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/image.png?resize=600%2C231&amp;ssl=1 600w" sizes="(max-width: 1090px) 100vw, 1090px" /></a></figure>



<h2 class="wp-block-heading">High-level approach</h2>



<p class="">The comparison process consists of three simple steps:</p>



<ol class="wp-block-list">
<li class="">Export both Azure SQL databases to DACPAC files</li>



<li class="">Use <code>sqlpackage.exe</code> with <code>/Action:Script</code></li>



<li class="">Review the generated delta script before applying it</li>
</ol>



<p class="">In this article, we focus on <strong>step 2</strong>, assuming you already have DACPAC files for both databases.</p>



<h2 class="wp-block-heading">Sample scenario</h2>



<p class="">Let us assume the following setup:</p>



<ul class="wp-block-list">
<li class=""><strong>Source (baseline)</strong> database: <code>sales-test-db</code></li>



<li class=""><strong>Target (to be aligned)</strong> database: <code>sales-prod-db</code></li>
</ul>



<p class="">Our goal is to compare Azure SQL Database schema and generate a SQL script that shows what changes are required to make <strong>Production</strong> match <strong>Test</strong>.</p>



<h2 class="wp-block-heading">Sample sqlpackage command</h2>



<p class="">Below is a sample <code>sqlpackage.exe</code> command to compare two DACPAC files and generate a delta script.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
sqlpackage.exe ^
  /Action:Script ^
  /SourceFile:&quot;C:\Dacpacs\sales-test-db.dacpac&quot; ^
  /TargetFile:&quot;C:\Dacpacs\sales-prod-db.dacpac&quot; ^
  /TargetDatabaseName:&quot;sales-prod-db&quot; ^
  /OutputPath:&quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot; ^
  /p:DropObjectsNotInSource=True

</pre></div>


<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?ssl=1"><img decoding="async" width="1153" height="221" data-attachment-id="9192" data-permalink="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/sqlpackage-to-compare-azure-sql-database-schema/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" data-orig-size="1153,221" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="sqlpackage to compare azure sql database schema" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?fit=1153%2C221&amp;ssl=1" alt="compare Azure SQL Database Schema using sqlpackage utility" class="wp-image-9192" style="aspect-ratio:5.217492752598458;width:881px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?w=1153&amp;ssl=1 1153w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=300%2C58&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=768%2C147&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=450%2C86&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2026/01/sqlpackage-to-compare-azure-sql-database-schema.png?resize=600%2C115&amp;ssl=1 600w" sizes="(max-width: 1153px) 100vw, 1153px" /></a></figure>



<p class="">In case you want to use PowerShell ISE, you can use below script.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: powershell; title: ; notranslate">
# Path to sqlpackage.exe
$sqlPackagePath = &quot;C:\Program Files\Microsoft SQL Server\160\DAC\bin\sqlpackage.exe&quot;

# DACPAC paths
$SourceDacpacPath = &quot;C:\Dacpacs\sales-test-db.dacpac&quot;
$TargetDacpacPath = &quot;C:\Dacpacs\sales-prod-db.dacpac&quot;

# Target database name
$TargetDatabaseName = &quot;sales-prod-db&quot;

# Output script path
$OutputScriptPath = &quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot;

# Publish options
$DropObjectsNotInSource = &quot;True&quot;

# Execute sqlpackage
&amp; $sqlPackagePath `
    /Action:Script `
    /SourceFile:$SourceDacpacPath `
    /TargetFile:$TargetDacpacPath `
    /TargetDatabaseName:$TargetDatabaseName `
    /OutputPath:$OutputScriptPath `
    /p:DropObjectsNotInSource=$DropObjectsNotInSource

</pre></div>


<p class="">This command does <strong>not</strong> apply any changes. It only generates a SQL script that you can review and execute manually if needed.</p>



<h2 class="wp-block-heading">Understanding each parameter</h2>



<p class="">Let us break down all the parameters used in the command.</p>



<p class=""><strong>/Action:Script</strong></p>



<p class="">Specifies that <code>sqlpackage</code> should <strong>generate a deployment script</strong> instead of publishing changes directly to a database. This is the safest option when comparing environments like Test and Production.</p>



<p class=""><strong>/SourceFile</strong></p>



<p class="">Path to the <strong>source DACPAC</strong> file. This represents the <em>desired state</em> of the database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/SourceFile:&quot;C:\Dacpacs\sales-test-db.dacpac&quot;
</pre></div>


<p class="">In our example, the Test database schema is treated as the source of truth.</p>



<p class=""><strong>/TargetFile</strong></p>



<p class="">Path to the <strong>target DACPAC</strong> file. This represents the database you want to compare against.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/TargetFile:&quot;C:\Dacpacs\sales-prod-db.dacpac&quot;
</pre></div>


<p class="">The generated script will contain changes required to make the target match the source.</p>



<p class=""><strong>/TargetDatabaseName</strong></p>



<p class="">Logical name of the target database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/TargetDatabaseName:&quot;sales-prod-db&quot;
</pre></div>


<p class="">This parameter is mandatory for the <code>Script</code> action, even when you are comparing DACPAC-to-DACPAC.</p>



<p class=""><strong>/OutputPath</strong></p>



<p class="">Specifies where the generated delta script should be written.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/OutputPath:&quot;C:\Dacpacs\sales_test_vs_prod_delta.sql&quot;
</pre></div>


<p class="">Always review this script carefully before executing it in Production.</p>



<p class=""><strong>/p:DropObjectsNotInSource</strong></p>



<p class="">Controls whether objects that exist in the target but not in the source should be dropped.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
/p:DropObjectsNotInSource=True
</pre></div>


<ul class="wp-block-list">
<li class=""><code>True</code> – Generates <code>DROP</code> statements for extra objects in the target</li>



<li class=""><code>False</code> – Preserves objects that exist only in the target</li>
</ul>



<p class="">⚠️ <strong>Use this option with caution</strong>, especially for Production databases.</p>



<h2 class="wp-block-heading">Common additional publish parameters</h2>



<p class="">Depending on your requirements, you may also consider these commonly used parameters:</p>



<ul class="wp-block-list">
<li class=""><code>/p:BlockOnPossibleDataLoss=False</code></li>



<li class=""><code>/p:IgnorePermissions=True</code></li>



<li class=""><code>/p:IgnoreRoleMembership=True</code></li>



<li class=""><code>/p:ExcludeObjectTypes=Users;Logins</code></li>



<li class=""><code>/p:ExcludeSchemaValidation=True</code></li>
</ul>



<p class="">These options help fine-tune the comparison and avoid unwanted differences.</p>



<h2 class="wp-block-heading">Best practices</h2>



<ul class="wp-block-list">
<li class="">Always generate a script first (<code>/Action:Script</code>)</li>



<li class="">Review the delta script line by line</li>



<li class="">Never auto-apply changes to Production without validation</li>



<li class="">Store DACPACs and scripts in source control</li>



<li class="">Use the same approach in CI/CD pipelines for consistency</li>
</ul>



<h2 class="wp-block-heading">Conclusion</h2>



<p class="">Comparing two Azure SQL databases using <code>sqlpackage.exe</code> is a reliable and automation-friendly approach. By working with DACPAC files and generating delta scripts, you gain full visibility and control over schema changes before they reach Production.</p>



<p class="">This method fits well into modern DevOps workflows and provides a safe alternative to manual or GUI-based comparisons.</p>



<p class="">If you regularly manage schema changes across multiple environments, <code>sqlpackage</code> should be a core part of your database deployment tool.</p>



<p class="has-light-green-cyan-background-color has-background"><strong>Pro tips</strong><br>1. If you want to generate BACPAC file of an Azure SQL database, you can refer to this <a href="https://azureops.org/articles/bacpac-large-sql-server-database/" target="_blank" rel="noreferrer noopener">post</a></p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<p>The post <a href="https://azureops.org/articles/compare-azure-sql-database-schema-using-sqlpackage/">Compare Azure SQL Database Schema Using sqlpackage</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">9188</post-id>	</item>
		<item>
		<title>Cross Database Query in Azure SQL Database</title>
		<link>https://azureops.org/articles/cross-database-query-in-azure-sql/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Wed, 05 Nov 2025 16:25:27 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[cross database access in azure sql]]></category>
		<category><![CDATA[elastic query in azure sql]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8505</guid>

					<description><![CDATA[<p>In modern cloud architectures, it&#8217;s common to distribute data across multiple Azure SQL Databases. While this promotes modularity and scalability, it can pose challenges when you need to access data across these databases. Fortunately, Azure SQL&#8217;s external tables feature allows for seamless cross-database querying without data duplication. This feature is also known as Elastic Query [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/cross-database-query-in-azure-sql/">Cross Database Query in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In modern cloud architectures, it&#8217;s common to distribute data across multiple Azure SQL Databases. While this promotes modularity and scalability, it can pose challenges when you need to access data across these databases. Fortunately, Azure SQL&#8217;s external tables feature allows for seamless cross-database querying without data duplication. This feature is also known as <a href="https://learn.microsoft.com/en-us/azure/azure-sql/database/elastic-query-overview?view=azuresql" target="_blank" rel="noreferrer noopener">Elastic Query</a> in Azure SQL database.This guide walks you through setting up cross database query in Azure SQL to reference a table from another Azure SQL Database, ensuring secure and efficient data access.</p>



<h3 class="wp-block-heading">Use Case &#8211; Imagine this scenario:</h3>



<ul class="wp-block-list">
<li>You have a <strong>main transactional database</strong> named <code>app-db</code> hosted on Azure SQL Server <code>app-db.database.windows.net</code>.</li>



<li>You also have a <strong>reference or lookup database</strong> named <code>source-db</code>, hosted on a separate Azure SQL Server: <code>source-server.database.windows.net</code>.</li>
</ul>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?ssl=1"><img data-recalc-dims="1" decoding="async" width="1536" height="1024" data-attachment-id="8572" data-permalink="https://azureops.org/articles/cross-database-query-in-azure-sql/elastic-query-access-in-azure-sql-database-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?fit=1536%2C1024&amp;ssl=1" data-orig-size="1536,1024" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Elastic query access in Azure SQL database" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?fit=1200%2C800&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?resize=1536%2C1024&#038;ssl=1" alt="Cross database query in Azure SQL database" class="wp-image-8572" style="width:616px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?w=1536&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Elastic-query-access-in-Azure-SQL-database-1.png?resize=300%2C200&amp;ssl=1 300w" sizes="(max-width: 1536px) 100vw, 1536px" /></a></figure>



<p>You want your <code>app-db</code> to query the table <code>dbo.external_table</code> from the <code>source-db</code> — without importing or copying the data. The goal is to enable live, read-only access to shared reference data across databases in a secure and manageable way.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites</strong><br>Before diving into the setup, ensure the following:<br><strong>1. Azure SQL Databases</strong>: Both the source and target databases should be Azure SQL Databases.<br><strong>2. Same Region</strong>: Ensure both databases are in the same Azure region to minimize latency.<br><strong>3. User Credentials</strong>: A SQL user say (<code>ext_table_user</code>) must exist in the source database with the necessary permissions to access the target table.</p>



<h3 class="wp-block-heading">Why Create Separate user in the Source Database?</h3>



<p>The <code>ext_table_user</code> is a SQL user in the source database that the target database uses to authenticate and access data. This user must have the necessary permissions (e.g., <code>SELECT</code>) on the target table.</p>



<p>Creating a dedicated user for external access enhances security by allowing you to:</p>



<ul class="wp-block-list">
<li><strong>Limit Permissions</strong>: Grant only the necessary permissions to this user.</li>



<li><strong>Monitor Access</strong>: Track and audit activities performed by this user.</li>



<li><strong>Revoke Access Easily</strong>: If needed, you can revoke this user&#8217;s access without affecting other users.</li>
</ul>



<p>Fow these <a href="https://azureops.org/articles/grant-access-to-azure-sql-database/" target="_blank" rel="noreferrer noopener">steps </a>to how to grant access to Azure SQL database. </p>



<h2 class="wp-block-heading">How to Setup Cross Database Access in Azure SQL</h2>



<p>Follow the below quick steps to setup cross database access in Azure SQL database.</p>



<h3 class="wp-block-heading">Step 1: Create a Master Key in the Target Database</h3>



<p>The master key is essential for encrypting credentials used in external data sources.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE MASTER KEY ENCRYPTION BY PASSWORD = &#039;YourStrongPasswordHere&#039;;
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p>Skip this if <code>SELECT * FROM sys.symmetric_keys WHERE name = '##MS_DatabaseMasterKey##'</code> already returns a row.</p>
</blockquote>



<h3 class="wp-block-heading">Step 2: Create a Database Scoped Credential</h3>



<p>This credential will be used to authenticate against the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE DATABASE SCOPED CREDENTIAL ext_table_user
WITH IDENTITY = &#039;ext_table_user&#039;,
     SECRET = &#039;ActualPasswordOfExtTableUser&#039;;
</pre></div>


<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">Step 3: Define the External Data Source</h3>



<p>This step establishes a connection to the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE EXTERNAL DATA SOURCE LinkedAzureSQLDB
WITH (
    TYPE = RDBMS,
    LOCATION = &#039;source-server.database.windows.net&#039;,
    DATABASE_NAME = &#039;source-db&#039;,
    CREDENTIAL = ext_table_user
);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Ensure</em>: Replace <code>'source-server.database.windows.net'</code> and <code>'source-db'</code> with your actual server and database names.</p>
</blockquote>



<h3 class="wp-block-heading">Step 4: Create the External Table</h3>



<p>Now, define the external table in the target database to reference the table in the source database.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

CREATE EXTERNAL TABLE dbo.external_table (
    &#x5B;ID] NUMERIC(18, 0) NOT NULL,
    &#x5B;list_id] INT NOT NULL,
    &#x5B;type_id] INT NOT NULL,
    &#x5B;description] VARCHAR(50) NULL
)
WITH (
    DATA_SOURCE = LinkedAzureSQLDB,
    SCHEMA_NAME = &#039;dbo&#039;,
    OBJECT_NAME = &#039;external_table&#039;
);
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Note</em>: The schema and object names should match those in the source database.</p>
</blockquote>



<h3 class="wp-block-heading">Step 5: Query the External Table</h3>



<p>With the setup complete, you can now query the external table as if it were local:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
-- Execute in the target database

SELECT TOP 10 * FROM dbo.external_table;
</pre></div>


<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p><em>Performance Tip</em>: Monitor query performance, as cross-database queries may have higher latency.</p>
</blockquote>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br><strong>1. Use Managed Identities</strong>: For enhanced security, consider using Azure Managed Identities instead of SQL authentication.<br>2. <strong>Monitor Performance</strong>: Regularly monitor the performance of cross-database queries to ensure they meet your application&#8217;s requirements.<br>3. <strong>Secure Credentials</strong>: Store sensitive information, like passwords, securely using Azure Key Vault.<br>4. <strong>Elastic query</strong> feature in Azure SQL is still in preview.</p>



<p>By following this guide, you can efficiently set up cross databse query in Azure SQL, enabling seamless cross-database querying while maintaining security and performance.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/8YVrxCgdiIg" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
<p>The post <a href="https://azureops.org/articles/cross-database-query-in-azure-sql/">Cross Database Query in Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8505</post-id>	</item>
		<item>
		<title>SSMS 21 Copilot: Here&#8217;s How It Works</title>
		<link>https://azureops.org/articles/ssms-21-copilot/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Sat, 11 Oct 2025 08:59:10 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Microsoft Copilot]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SSMS]]></category>
		<category><![CDATA[SSMS with Copilot]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8592</guid>

					<description><![CDATA[<p>SQL Server Management Studio (SSMS) version 21 introduces native Copilot integration, enhancing SQL development. Users can connect to Azure OpenAI for efficient query generation and debugging in read-only mode. Copilot aids in writing, fixing, and optimizing SQL queries without executing modifications, ensuring control and security over data.</p>
<p>The post <a href="https://azureops.org/articles/ssms-21-copilot/">SSMS 21 Copilot: Here&#8217;s How It Works</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">SQL Server Management Studio (SSMS) has been a staple for database professionals for years. With version 21, Microsoft has added something many users have been waiting for: <strong>native Copilot integration</strong>. No extensions, no hacks—just open it up, connect to Azure, and start working smarter. Here’s a walkthrough of the most important features SSMS 21 Copilot offers and how they work in practice.</p>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>You write the query, run it, catch a missing condition, tweak the join, test again—repeat until it’s right. SSMS 21 brings Copilot into that loop. </em></p>
</blockquote>



<h2 class="wp-block-heading"><strong>TL;DR:</strong></h2>



<ul class="wp-block-list">
<li class="">SSMS 21 now includes <strong>built-in Copilot</strong>—no extensions. Just require connection to your <strong>Azure OpenAI deployment</strong> (like GPT-4o).</li>



<li class="">Works only with <strong>SQL Server connections</strong> (not SSIS, SSAS, or SSRS).</li>



<li class="">Runs in <strong>read-only mode</strong>—won’t execute any DML or modify data.</li>



<li class="">Can <strong>generate queries</strong>, fix broken SQL, and suggest optimizations.</li>



<li class="">Supports prompts like: “fix this query,” “optimize for performance,” or “generate insert script.”</li>



<li class="">Ideal for SQL developers who want help writing, debugging, or learning better query patterns—without giving up control.</li>
</ul>



<h2 class="wp-block-heading">Installation: Copilot Comes Built-in</h2>



<p class="">The installer for <a href="https://learn.microsoft.com/en-us/ssms/install/install" target="_blank" rel="noreferrer noopener">SSMS 21</a> clearly shows that Copilot is not an afterthought—it’s front and center. Once you launch the installer, you&#8217;ll notice the <strong>&#8220;Copilot Integration&#8221;</strong> checkbox enabled by default. This means no manual setup is required post-install. It&#8217;s part of the core experience now.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?ssl=1"><img loading="lazy" decoding="async" width="1258" height="705" data-attachment-id="8595" data-permalink="https://azureops.org/articles/ssms-21-copilot/ssms-21-installation-with-copilot/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1258%2C705&amp;ssl=1" data-orig-size="1258,705" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SSMS 21 installation with copilot" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1200%2C672&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?fit=1200%2C672&amp;ssl=1" alt="ssms 21 copilot installation" class="wp-image-8595" style="width:793px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?w=1258&amp;ssl=1 1258w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=300%2C168&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=1200%2C672&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=1106%2C620&amp;ssl=1 1106w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=768%2C430&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=450%2C252&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/SSMS-21-installation-with-copilot.png?resize=600%2C336&amp;ssl=1 600w" sizes="(max-width: 1258px) 100vw, 1258px" /></a></figure>



<h3 class="wp-block-heading">First Run: Setting Up Your Azure OpenAI Keys</h3>



<p class="">Once SSMS launches, you’ll be prompted to connect Copilot to your <strong>Azure OpenAI</strong> setup.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?ssl=1"><img loading="lazy" decoding="async" width="1086" height="778" data-attachment-id="8596" data-permalink="https://azureops.org/articles/ssms-21-copilot/enter-open-ai-service-key/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" data-orig-size="1086,778" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="enter open ai service key" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?fit=1086%2C778&amp;ssl=1" alt="ssms 21 copilot installation - seeting up openai details" class="wp-image-8596" style="width:718px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?w=1086&amp;ssl=1 1086w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=300%2C215&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=865%2C620&amp;ssl=1 865w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=768%2C550&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=450%2C322&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/enter-open-ai-service-key.png?resize=600%2C430&amp;ssl=1 600w" sizes="(max-width: 1086px) 100vw, 1086px" /></a></figure>



<p class="">In the first prompt, you’ll be asked to provide:</p>



<ul class="wp-block-list">
<li class="">Azure OpenAI service endpoint</li>



<li class="">Azure OpenAI deployment</li>



<li class="">Azure OpenAI API key</li>
</ul>



<p class="">If you haven’t already created this in Azure, it’s a quick process: deploy a model, generate a key, and you’re good to go. we see how this information is pasted into SSMS.</p>



<p class="">It’s a one-time step, and once entered, Copilot starts responding instantly within SSMS.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?ssl=1"><img loading="lazy" decoding="async" width="996" height="523" data-attachment-id="8601" data-permalink="https://azureops.org/articles/ssms-21-copilot/keys-and-endpoint-3/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" data-orig-size="996,523" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="keys and endpoint" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?fit=996%2C523&amp;ssl=1" alt="Create open ai service and get openai endpoint and key." class="wp-image-8601" style="width:802px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?w=996&amp;ssl=1 996w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=300%2C158&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=768%2C403&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=450%2C236&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/keys-and-endpoint-2.png?resize=600%2C315&amp;ssl=1 600w" sizes="(max-width: 996px) 100vw, 996px" /></a></figure>



<p class="">To get an Azure <strong>OpenAI deployment </strong>name for SSMS Copilit, we need Gen AI model. That’s the engine powering your Copilot. GPT-4o is optimized for speed and real-time interaction, making it well-suited for something as dynamic as SQL writing and analysis.</p>



<p class="">If you already use GPT-based models in Azure, you can reuse the same deployment. If not, create a new one and pick GPT-4o or other depending on availability.</p>



<h2 class="wp-block-heading">Which Connections Are Supported?</h2>



<p class="">As of now, <strong>Copilot in SSMS works only with SQL Server connections</strong>—whether it&#8217;s a local database or Azure SQL.</p>



<p class="">It does <strong>not</strong> support:</p>



<ul class="wp-block-list">
<li class="">SQL Server Integration Services (SSIS)</li>



<li class="">SQL Server Analysis Services (SSAS)</li>



<li class="">SQL Server Reporting Services (SSRS)</li>
</ul>



<p class="">So if you’re connected to an SSIS or SSAS instance, you won’t see Copilot suggestions. It’s focused purely on <strong>Transact-SQL (T-SQL)</strong> scenarios for now.</p>



<h3 class="wp-block-heading">Read-Only Mode – No Live Data Changes</h3>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>Copilot works in a read-only mode inside SSMS</em> for GOOD.</p>
</blockquote>



<p class="">It will <strong>not execute updates, deletes, or any data-modifying queries</strong> on its own. It doesn’t have permissions to alter databases or run DML commands. You remain in full control.</p>



<p class="">That said, it <strong>can generate</strong> update, insert, and delete queries for you, which you can review, tweak, and run manually. This helps reduce the risk of accidental changes while still speeding up development.</p>



<h2 class="wp-block-heading">Quick Demo: Fixing a Broken Query</h2>



<p class="">I pasted a malformed SELECT query into SSMS. Copilot immediately offered a fix and even explained what was wrong.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?ssl=1"><img loading="lazy" decoding="async" width="1332" height="277" data-attachment-id="8604" data-permalink="https://azureops.org/articles/ssms-21-copilot/fix-sql-query-in-ssms-using-copilot/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1332%2C277&amp;ssl=1" data-orig-size="1332,277" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Fix SQL Query in SSMS using copilot" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1200%2C250&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?fit=1200%2C250&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8604" style="width:1023px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?w=1332&amp;ssl=1 1332w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=300%2C62&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=1200%2C250&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=768%2C160&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=450%2C94&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/Fix-SQL-Query-in-SSMS-using-copilot.png?resize=600%2C125&amp;ssl=1 600w" sizes="(max-width: 1332px) 100vw, 1332px" /></a></figure>



<h3 class="wp-block-heading">Few Prompt Examples: Result Accuracy</h3>



<p class="">In below example, we asked Copilot to generate a complex query involving filters, aggregates, and joins. The result was accurate and ready to run with minimal edits.</p>



<figure class="wp-block-image size-large is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?ssl=1"><img loading="lazy" decoding="async" width="1591" height="968" data-attachment-id="8607" data-permalink="https://azureops.org/articles/ssms-21-copilot/result-1/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1591%2C968&amp;ssl=1" data-orig-size="1591,968" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="result 1" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1200%2C730&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?fit=1200%2C730&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8607" style="width:890px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?w=1591&amp;ssl=1 1591w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=300%2C183&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1200%2C730&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1019%2C620&amp;ssl=1 1019w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=768%2C467&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=1536%2C935&amp;ssl=1 1536w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=450%2C274&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-1.png?resize=600%2C365&amp;ssl=1 600w" sizes="(max-width: 1591px) 100vw, 1591px" /></a></figure>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class=""> the same query was further optimized by Copilot after being prompted with: <em>&#8220;Make it efficient.&#8221;</em> It introduced indexing suggestions and added a <code>WITH (NOLOCK)</code> hint—something even experienced developers can forget.</p>



<p class="">In another example, we asked Copilot another question on a different query context (another database connection), and it just worked fine.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?ssl=1"><img loading="lazy" decoding="async" width="674" height="275" data-attachment-id="8608" data-permalink="https://azureops.org/articles/ssms-21-copilot/result-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" data-orig-size="674,275" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="result 2" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?fit=674%2C275&amp;ssl=1" alt="SSMS 21 Copilot" class="wp-image-8608" style="width:575px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?w=674&amp;ssl=1 674w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=300%2C122&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=450%2C184&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/06/result-2.png?resize=600%2C245&amp;ssl=1 600w" sizes="(max-width: 674px) 100vw, 674px" /></a></figure>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow">
<p class=""><em>These examples show that Copilot isn’t just copying boilerplate SQL—it understands context and best practices.</em></p>
</blockquote>



<h2 class="wp-block-heading">Should You Use This?</h2>



<p class="">If your daily work involves writing or reading SQL, then yes—this is probably the most useful update to SSMS in years.</p>



<p class="">Here’s what it helps with:</p>



<ul class="wp-block-list">
<li class="">Writing long queries faster</li>



<li class="">Understanding joins and filters</li>



<li class="">Fixing syntax issues</li>



<li class="">Learning better SQL patterns</li>



<li class="">Generating stored procedure templates</li>



<li class="">Drafting DML scripts (but not running them automatically)</li>
</ul>



<h2 class="wp-block-heading">What It Won’t Do (Yet)</h2>



<p class="">Let’s be clear:</p>



<ul class="wp-block-list">
<li class="">It won’t <strong>connect to SSIS/SSAS/SSRS</strong></li>



<li class="">It won’t <strong>execute anything that modifies data</strong></li>



<li class="">It won’t <strong>automatically run</strong> DDL/ DML code it suggests</li>
</ul>



<p class="">This is intentional, for safety and audit reasons. Think of it as a smart assistant—not a trigger-happy automation engine.</p>



<h2 class="wp-block-heading">A Note on Privacy and Control</h2>



<p class="">Copilot integrates directly with your Azure environment, so you control what it accesses and shares. It processes your prompts and data securely within your subscription. According to Microsoft, it doesn&#8217;t store any query logs outside your environment, which helps meet compliance requirements for enterprise users.</p>



<p class="">SSMS 21 doesn’t just add Copilot—it integrates it naturally into the flow of writing, editing, and reviewing SQL. It’s fast, context-aware, and doesn’t get in the way.</p>



<p class="has-background" style="background-color:#beefca"><strong>Pro tips:</strong><br>1. While it&#8217;s good to have Copilot like features in SSMS 21, it seems to have lost some very important features like Import Export Wizard for databases like Azure SQL.<br>2. <a href="https://azureops.org/articles/data-agent-in-microsoft-fabric-heres-how-it-works/" target="_blank" rel="noreferrer noopener">Learn</a> how to build data agent in Microsoft Fabric.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/ssms-21-copilot/">SSMS 21 Copilot: Here&#8217;s How It Works</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8592</post-id>	</item>
		<item>
		<title>Connect Python Azure Function to Azure SQL Using Managed Identity</title>
		<link>https://azureops.org/articles/connect-python-azure-function-to-azure-sql-using-managed-identity/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 18 Sep 2025 18:21:20 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[Managed Identity]]></category>
		<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8874</guid>

					<description><![CDATA[<p>An Azure Function is a lightweight, serverless compute option in Azure that lets you execute small chunks of code in response to events or schedules without managing servers. When connecting Azure Functions to Azure SQL Database, you need a secure way to authenticate without storing credentials. That’s where Managed Identity steps in. Managed Identity allows [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/connect-python-azure-function-to-azure-sql-using-managed-identity/">Connect Python Azure Function to Azure SQL Using Managed Identity</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">An <strong>Azure Function</strong> is a lightweight, serverless compute option in Azure that lets you execute small chunks of code in response to events or schedules without managing servers. When connecting Azure Functions to <strong>Azure SQL Database</strong>, you need a secure way to authenticate without storing credentials. That’s where <strong>Managed Identity</strong> steps in. Managed Identity allows Azure resources (like Functions, VMs, Logic Apps) to access other Azure services securely by leveraging <strong>Azure Active Directory (AAD)</strong>.In this article, we’ll explore how to connect <a href="https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-python?tabs=get-started%2Casgi%2Capplication-level&amp;pivots=python-mode-decorators" target="_blank" rel="noreferrer noopener">Python Azure Function</a><strong> to Azure SQL</strong> using <strong>Managed Identity</strong>. You’ll learn step-by-step setup, Python code implementation, troubleshooting, and best practices to ensure your solution is secure and scalable.</p>



<h2 class="wp-block-heading">Why Use Managed Identity with Azure SQL?</h2>



<p class="">Storing passwords in configuration files is risky. Managed Identity solves this problem by:</p>



<ul class="wp-block-list">
<li class=""><strong>Eliminating Secrets</strong> → No passwords, no connection strings with credentials.</li>



<li class=""><strong>Centralized Identity Management</strong> → Uses <strong>Azure AD authentication</strong> for consistency.</li>



<li class=""><strong>Least Privilege Principle</strong> → Assigns only the required SQL permissions.</li>



<li class=""><strong>Automatic Rotation</strong> → No need to update or rotate credentials manually.</li>
</ul>



<p class="">This makes it the <strong>recommended authentication method</strong> when connecting Azure Functions to SQL Database.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites:</strong><br>Before implementing, ensure you have:<br>1. An Azure subscription.<br>2. An Azure SQL Database already created.<br>3. An Azure Function App (Python runtime).<br>4. Azure CLI or Portal access.</p>



<p class="">This guide assumes you already have a basic understanding of creating an Azure Function. If you need a refresher, please refer to our previous article on <a href="https://azureops.org/articles/create-python-azure-function/" target="_blank" rel="noreferrer noopener">How to Create a Python Azure Function</a>.</p>



<p class="">Let&#8217;s now see how to connect Python Azure Function to Azure SQL database using managed identity authentication. In this example we will fetch data from a public API and securely write it to an <strong>Azure SQL Database</strong> table..</p>



<h3 class="wp-block-heading">Step 1: Set Up Your Azure SQL Database</h3>



<h4 class="wp-block-heading">Creating WeatherData Table</h4>



<p class="">In this guide, we’ll simulate fetching weather data from an API and storing it in Azure SQL.</p>



<p class="">Run the following SQL script inside your Azure SQL database:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
CREATE TABLE WeatherData (
    Id INT PRIMARY KEY IDENTITY(1,1),
    City VARCHAR(100),
    Temperature DECIMAL(5,2),
    Humidity INT,
    ForecastDate DATETIME
);

</pre></div>


<h3 class="wp-block-heading">Step 2: Enabling Managed Identity for Azure Function</h3>



<p class="">INavigate to your <strong>Function App</strong> in Azure Portal.</p>



<p class="">Under <strong>Settings → Identity</strong>, enable <strong>System Assigned Managed Identity</strong>.</p>



<p class="">Azure will create an identity in Microsoft Entra representing your Function.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?ssl=1"><img loading="lazy" decoding="async" width="1072" height="715" data-attachment-id="8884" data-permalink="https://azureops.org/articles/connect-python-azure-function-to-azure-sql-using-managed-identity/enable-azure-function-managed-identity/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?fit=1072%2C715&amp;ssl=1" data-orig-size="1072,715" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Enable Azure function managed identity" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?fit=1072%2C715&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?fit=1072%2C715&amp;ssl=1" alt="Connect Python Azure Function to Azure SQL" class="wp-image-8884" style="width:821px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?w=1072&amp;ssl=1 1072w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?resize=300%2C200&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?resize=930%2C620&amp;ssl=1 930w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?resize=768%2C512&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?resize=450%2C300&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Enable-Azure-function-managed-identity.png?resize=600%2C400&amp;ssl=1 600w" sizes="(max-width: 1072px) 100vw, 1072px" /></a></figure>



<h3 class="wp-block-heading">Step 3: Grant the Managed Identity Access to Azure SQL</h3>



<h4 class="wp-block-heading">Configuring Azure Entra Admin</h4>



<p class="">To allow <strong>Managed Identity</strong> to authenticate, assign an <strong>Azure Entra admin</strong> for your SQL server.</p>



<ol class="wp-block-list">
<li class="">Go to Azure Portal → SQL Server → <strong>Active Entra Admin</strong>.</li>



<li class="">Assign an Azure Entra user/group as the admin.</li>



<li class="">Save changes.</li>
</ol>



<h3 class="wp-block-heading">Grant the permissions</h3>



<p class="">Now, connect to to your Azure SQL Database using the Entra ID authentication. You need to grant the Managed Identity permission to write to the database. Use the following T-SQL commands, replacing <code>&lt;your-azure-function-name&gt;</code> with the name of your function:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
CREATE USER &#x5B;your-azure-function-name] FROM EXTERNAL PROVIDER;
ALTER ROLE db_datawriter ADD MEMBER &#x5B;your-azure-function-name];
</pre></div>


<ul class="wp-block-list">
<li class=""><code>CREATE USER</code> creates the identity inside SQL.</li>



<li class=""><code>ALTER ROLE</code> gives write permissions to insert/update/delete.</li>
</ul>



<p class="">Learn how to grant access to Azure SQL databases in this <a href="https://azureops.org/articles/grant-access-to-azure-sql-database/" target="_blank" rel="noreferrer noopener">post</a>.</p>



<h3 class="wp-block-heading">Step 4: Configure Application Settings</h3>



<p class="">In the Function App Environment variables, define following variables.</p>



<ul class="wp-block-list">
<li class=""><strong>SqlConnectionInfo</strong> → <code>Server=&lt;your-sql-server&gt;.database.windows.net;Database=&lt;your-db&gt;;</code></li>



<li class=""><strong>WEATHER_API_URL</strong> → https://api.open-meteo.com/v1/forecast?latitude=60.17&amp;longitude=24.94&amp;hourly=temperature_2m,relative_humidity_2m</li>



<li class=""><strong>TIMER_SCHEDULE</strong> → <code>0 * * * * *</code> (Runs every hour).</li>
</ul>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?ssl=1"><img loading="lazy" decoding="async" width="975" height="677" data-attachment-id="8886" data-permalink="https://azureops.org/articles/connect-python-azure-function-to-azure-sql-using-managed-identity/add-environment-variables-to-azure-function/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?fit=975%2C677&amp;ssl=1" data-orig-size="975,677" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Add environment variables to Azure function" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?fit=975%2C677&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?fit=975%2C677&amp;ssl=1" alt="Azure Function configuration settings
" class="wp-image-8886" style="width:850px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?w=975&amp;ssl=1 975w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?resize=300%2C208&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?resize=893%2C620&amp;ssl=1 893w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?resize=768%2C533&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?resize=450%2C312&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/09/Add-environment-variables-to-Azure-function.png?resize=600%2C417&amp;ssl=1 600w" sizes="(max-width: 975px) 100vw, 975px" /></a></figure>



<h3 class="wp-block-heading">Step 5: Writing Python Azure Function Code</h3>



<p class="">Now, it&#8217;s time to write the code that will perform the data fetching and insertion. For this example, we&#8217;ll use a Python HTTP-triggered function and the <code>requests</code> and <code>pyodbc</code> libraries. You will also need the <code>azure-identity</code> package to handle the Managed Identity authentication.</p>



<h4 class="wp-block-heading">1. Installing Required Packages</h4>



<p class="">Add to <code>requirements.txt</code>:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; gutter: false; title: ; notranslate">
azure-functions
requests
pypyodbc
</pre></div>


<h4 class="wp-block-heading">2. Write the function code (<code>__init__.py</code>):</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
import azure.functions as func
import logging, os, requests, pypyodbc

app = func.FunctionApp()

@app.timer_trigger(schedule=&quot;%TIMER_SCHEDULE%&quot;, arg_name=&quot;myTimer&quot;)
def load_weather_data_to_sql(myTimer: func.TimerRequest):
    if myTimer.past_due:
        logging.info(&quot;The timer is past due!&quot;)

    try:
        url = os.getenv(&quot;WEATHER_API_URL&quot;)
        response = requests.get(url)
        data = response.json().get(&quot;current&quot;, {})
        
        temperature = data.get(&quot;temperature_2m&quot;)
        humidity = data.get(&quot;relative_humidity_2m&quot;)
        city = &quot;Berlin&quot;

        conn = get_sql_connection()
        cursor = conn.cursor()
        cursor.execute(
            &quot;INSERT INTO WeatherData (City, Temperature, Humidity, ForecastDate) VALUES (?, ?, ?, GETDATE())&quot;,
            (city, temperature, humidity)
        )
        conn.commit()
        cursor.close()
        conn.close()
        logging.info(&quot;Weather data inserted successfully&quot;)

    except Exception as e:
        logging.error(f&quot;Error: {e}&quot;)

def get_sql_connection():
    conn_info = os.getenv(&quot;SqlConnectionInfo&quot;)
    parts = dict(item.split(&quot;=&quot;,1) for item in conn_info.split(&quot;;&quot;) if &quot;=&quot; in item)
    server, db = parts.get(&quot;Server&quot;), parts.get(&quot;Database&quot;)
# Depending on the python version, select appropriate ODBC Driver. For latest version 3.12, use ODBC Driver 18. For previous versions, try ODBC Driver 17.
    conn_str = f&quot;DRIVER={{ODBC Driver 18 for SQL Server}};Server={server};Database={db};Authentication=ActiveDirectoryMsi;&quot;
    return pypyodbc.connect(conn_str)

</pre></div>


<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">Step 6: Testing the Integration</h3>



<h4 class="wp-block-heading">Running Function Locally</h4>



<ul class="wp-block-list">
<li class="">Use <strong>Azure Functions Core Tools</strong>.</li>



<li class="">Set local.settings.json with required env variables.</li>



<li class="">Test the API call and SQL insertion.</li>
</ul>



<h4 class="wp-block-heading">Deploying to Azure</h4>



<ul class="wp-block-list">
<li class="">Push code to Azure Function App.</li>



<li class="">Check logs in <strong>Application Insights</strong> or <code>Log Stream</code>.</li>



<li class="">Common Issues and Troubleshooting.</li>
</ul>



<h2 class="wp-block-heading">Best Practices for Secure and Scalable Integration</h2>



<ul class="wp-block-list">
<li class="">Use <strong>least privilege</strong> for SQL roles.</li>



<li class="">Store configs in <strong>Azure Key Vault</strong>.</li>



<li class="">Monitor using <strong>Azure Monitor + Application Insights</strong>.</li>



<li class="">Implement retry logic for transient failures.</li>
</ul>



<h2 class="wp-block-heading">FAQs</h2>


<div class="wp-block-uagb-faq uagb-faq__outer-wrap uagb-block-1f3f6ec0 uagb-faq-icon-row uagb-faq-layout-accordion uagb-faq-expand-first-true uagb-faq-inactive-other-true uagb-faq__wrap uagb-buttons-layout-wrap uagb-faq-equal-height     " data-faqtoggle="true" role="tablist"><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-152cbd76 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">Can I use User-Assigned Managed Identity instead of System-Assigned?</span></div><div class="uagb-faq-content"><p>Yes, both are supported. User-assigned is better for multiple Functions sharing one identity.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-588ab62f " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">What if I want read-only access to SQL?</span></div><div class="uagb-faq-content"><p>Assign the <code>db_datareader</code> role instead of <code>db_datawriter</code>.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-81419b26 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">Does Managed Identity work with Elastic Pools?</span></div><div class="uagb-faq-content"><p>Yes, it works across all Azure SQL deployment models.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-9bb291eb " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">Is pypyodbc required or can I use pyodbc?</span></div><div class="uagb-faq-content"><p>In Azure Functions Linux consumption plan, <code>pypyodbc</code> works more reliably.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-e8d40354 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">Can I connect to SQL Server on-prem using Managed Identity?</span></div><div class="uagb-faq-content"><p>Not directly. You’d need a Hybrid Connection or VPN.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-8a7feb69 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">Azure function execution giving Error: Error during function execution: (&#8216;01000&#8217;, &#8220;[01000] [unixODBC][Driver Manager]Can&#8217;t open lib &#8216;ODBC Driver 17 for SQL Server&#8217; : file not found&#8221;)</span></div><div class="uagb-faq-content"><p>This error usually occurs due to mismatch of ODBC Driver version. Depending on the python version, select appropriate ODBC Driver. For latest version 3.12, use ODBC Driver 18. For previous versions, try ODBC Driver 17.</p></div></div></div>


<h2 class="wp-block-heading">Conclusion</h2>



<p class="">By following these steps, you’ve securely connected a <strong>Python Azure Function</strong> to an <strong>Azure SQL Database</strong> using <strong>Managed Identity</strong>. This approach avoids hardcoding credentials, ensures automatic rotation, and aligns with cloud security best practices.</p>



<p class="">With this foundation, you can extend the Function to handle more APIs, perform ETL pipelines, or automate reporting tasks, all while staying secure and compliant.</p>



<p class="has-background" style="background-color:#beefca"><strong>Pro tips:</strong><br>1. Always prefer pypyodbc in Functions to avoid dependency issues.<br>2. Use retry policies when inserting data into SQL.<br>3. Keep Functions lightweight, offload heavy processing to Azure Data Factory or Microsoft Fabric.<br>4. If scaling out, validate SQL performance with connection pooling.<br>5. Learn how to <a href="https://azureops.org/articles/connect-azure-sql-from-data-factory-using-managed-identity/" target="_blank" rel="noreferrer noopener">connect to Azure SQL from Azure Data Factory</a> using managed identity.<br></p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/connect-python-azure-function-to-azure-sql-using-managed-identity/">Connect Python Azure Function to Azure SQL Using Managed Identity</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8874</post-id>	</item>
		<item>
		<title>Azure Analysis Services Model Missing</title>
		<link>https://azureops.org/articles/azure-analysis-services-model-missing/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 01 May 2025 14:19:00 +0000</pubDate>
				<category><![CDATA[Analysis Services]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[azure analysis services admin]]></category>
		<category><![CDATA[azure analysis services model disappear]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8399</guid>

					<description><![CDATA[<p>In this article, we will see how to fix Azure Analysis Services model missing issue.</p>
<p>The post <a href="https://azureops.org/articles/azure-analysis-services-model-missing/">Azure Analysis Services Model Missing</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Last week, our <a href="https://azure.microsoft.com/en-us/products/analysis-services" target="_blank" rel="noreferrer noopener">Azure Analysis Services</a> Model suddenly disappeared and all the PowerBI reports using that model stopped working or<a href="https://azureops.org/articles/connect-to-azure-analysis-services/" target="_blank" rel="noreferrer noopener"> connection to AAS model from SSMS</a> not working. If the account that was the owner of the Azure Analysis Services (AAS) model, and it got deleted, the model might have become inaccessible because there are no active administrators left. In this article, we will see how to fix Azure Analysis Services model missing issue.</p>



<h3 class=" wp-block-heading">Assign a New Admin via Azure Portal</h3>



<ol class="wp-block-list">
<li class="">Go to the <strong>Azure Portal</strong>.</li>



<li class="">Navigate to <strong>Azure Analysis Services</strong>.</li>



<li class="">Find the AAS server where your model was deployed.</li>



<li class="">Under <strong>Settings</strong>, click <strong>Administrators</strong>.</li>



<li class="">Add a new administrator (Global Admins or Subscription Owners can do this).</li>



<li class="">Save the changes.</li>



<li class="">Delete the inactive admin account if any from the admin list.</li>
</ol>



<figure class="wp-block-image size-large"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="661" data-attachment-id="8401" data-permalink="https://azureops.org/articles/azure-analysis-services-model-missing/how-to-fix-azure-analysis-services-model-missing-issue/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?fit=1351%2C744&amp;ssl=1" data-orig-size="1351,744" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="How to fix Azure analysis services model missing issue" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?fit=1200%2C661&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=1200%2C661&#038;ssl=1" alt="Azure Analysis Services Model Missing" class="wp-image-8401" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=1200%2C661&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=300%2C165&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=1126%2C620&amp;ssl=1 1126w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=768%2C423&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=450%2C248&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?resize=600%2C330&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/04/How-to-fix-Azure-analysis-services-model-missing-issue.png?w=1351&amp;ssl=1 1351w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<p class="">With the addition of a new admin account, the Azure Analysis Services model missing issue is resolved.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/azure-analysis-services-model-missing/">Azure Analysis Services Model Missing</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8399</post-id>	</item>
		<item>
		<title>Automate Databricks Infrastructure as Code with Terraform</title>
		<link>https://azureops.org/articles/automate-databricks-infrastructure-as-code-with-terraform/</link>
		
		<dc:creator><![CDATA[James Sandy]]></dc:creator>
		<pubDate>Fri, 04 Apr 2025 18:47:31 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Databricks]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[Terraform]]></category>
		<category><![CDATA[Databricks cicd]]></category>
		<category><![CDATA[IAAC]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8414</guid>

					<description><![CDATA[<p>This article describes how to Implement Infrastructure as Code Databricks with Terraform.</p>
<p>The post <a href="https://azureops.org/articles/automate-databricks-infrastructure-as-code-with-terraform/">Automate Databricks Infrastructure as Code with Terraform</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Terraform can be used to provision, manage, and scale Databricks environments; it allows i<a href="https://learn.microsoft.com/en-us/devops/deliver/what-is-infrastructure-as-code">nfrastructure to be defined as code (IaC)</a>, enabling version control, reproducibility, and automation. Using Terraform to deploy Databricks workspace streamlines resource provisioning, access management, and workspace configuration to ensure consistency across environments and simplify scaling or modifications. This article describes how to Automate Databricks Infrastructure with Terraform.</p>



<h2 class="wp-block-heading"><a></a>Terraform Environment Setup</h2>



<p class="">Databricks is a cloud-based tool built on Apache Spark used in machine learning, big data analytics, and data engineering to enable AI model deployment, fast data processing, and collaboration. Its scalable Delta Lake infrastructure supports its efficient, secure data management.</p>



<p class="">To manage Databricks infrastructure with Terraform, you have to install and configure some of the systems; the first step is installing Terraform and the Databricks provider. Download Terraform from the <a href="https://developer.hashicorp.com/terraform/downloads">official website</a> and ensure it is available in the system&#8217;s path, and then initialize a Terraform working directory by creating a new directory and running :</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; title: ; notranslate">
terraform init
</pre></div>


<p class="">Authentication in Databricks is configured using the credentials from cloud providers. A service principal is used to set up authentication for Azure:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [2]; title: ; notranslate">
provider &quot;databricks&quot; {
 host  = &quot;https://&lt;your-databricks-instance&gt;&quot;
 azure_client_id     = var.azure_client_id
 azure_client_secret = var.azure_client_secret
 azure_tenant_id     = var.azure_tenant_id
}
</pre></div>


<p class="">An Access key or service accounts will be required for AWS and GCP</p>



<h2 class="wp-block-heading"><a></a>Databricks Infrastructure with Terraform Setup</h2>



<p class="">Terraform allows configuration using HCL (Hashicorp Configuration Language). and configurations are made in the primary configuration file, main.tf, declares a Databricks workspace:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1,2,3,4]; title: ; notranslate">
resource &quot;databricks_workspace&quot; &quot;example&quot; {
 name          = &quot;example-workspace&quot;
 resource_group = &quot;example-rg&quot;
 location      = &quot;East US&quot;
}
</pre></div>


<p class="">Configuring clusters within a workspace requires some important setup, like versioning, autoscaling, and specific nodes:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1,2]; title: ; notranslate">
resource &quot;databricks_cluster&quot; &quot;example&quot; {
 cluster_name            = &quot;example-cluster&quot;
 spark_version           = &quot;12.0.x-scala2.12&quot;
 node_type_id            = &quot;Standard_D3_v2&quot;
 autotermination_minutes = 20
 autoscale {
   min_workers = 2
   max_workers = 8
 }
}
</pre></div>


<h2 class="wp-block-heading"><a></a>Access Control and Permissions</h2>



<p class="">Terraform will be able to control user roles and access control lists using the Databricks permission control user and group access</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1,2,5,6,7]; title: ; notranslate">
resource &quot;databricks_group&quot; &quot;data_scientists&quot; {
 display_name = &quot;Data Scientists&quot;
}

resource &quot;databricks_user&quot; &quot;analyst&quot; {
 user_name  = &quot;analyst@example.com&quot;
 groups     = &#x5B;databricks_group.data_scientists.id]
}
</pre></div>


<p class="">Integrating Terraform with a cloud IAM system like <a href="https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id">Microsoft Entra Id</a> ensures authentication and access policies are in line with enterprise governance best practices.</p>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h2 class="wp-block-heading"><a></a>Deploying Databricks Jobs with Terraform</h2>



<p class="">Databricks jobs are used to automate batch and streaming workloads; the databricks_job resources define the job execution parameters:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1,2,9]; title: ; notranslate">
resource &quot;databricks_job&quot; &quot;example_job&quot; {
 name = &quot;Example Job&quot;
 new_cluster {
   spark_version = &quot;12.0.x-scala2.12&quot;
   node_type_id  = &quot;Standard_D3_v2&quot;
   num_workers   = 4
 }
 notebook_task {
   notebook_path = &quot;/Shared/example_notebook&quot;
 }
}
</pre></div>


<p class="">Scheduling jobs and dependencies are managed within Terraform, allowing seamless automation of recurring tasks.</p>



<h2 class="wp-block-heading"><a></a>Versioning with Terraform</h2>



<p class="">Terraform uses a state file to track all deployed resources to ensure collaborations and prevent conflicts, so remote state storage must be configured.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [3,4,5,6]; title: ; notranslate">
terraform {
 backend &quot;azurerm&quot; {
   resource_group_name  = &quot;terraform-state-rg&quot;
   storage_account_name = &quot;tfstateaccount&quot;
   container_name       = &quot;tfstate&quot;
   key                  = &quot;databricks.tfstate&quot;
 }
}
</pre></div>


<p class="">This ensures changes made to infrastructure are managed safely using <em>terraform plan</em> and <em>terraform apply</em>, preventing unintended changes.</p>



<h2 class="wp-block-heading"><a></a>Automating Deployment with CI/CD</h2>



<p class="">To ensure infrastructure with consistency, Terraform needs to integrate with CI/CD; a Github action pipeline can be used for automated deployments:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; title: ; notranslate">
name: Terraform Deployment
on: &#x5B;push]
jobs:
 deploy:
   runs-on: ubuntu-latest
   steps:
     - uses: actions/checkout@v3
     - name: Setup Terraform
       uses: hashicorp/setup-terraform@v1
     - name: Terraform Init
       run: terraform init
     - name: Terraform Apply
       run: terraform apply -auto-approve
</pre></div>


<p class="">This pipeline can also be configured in GitLab CI/CD or Azure DevOps for streamlined deployments.</p>



<h2 class="wp-block-heading"><a></a>Monitoring and Scaling Databricks infrastructure</h2>



<p class="">Databricks environments require monitoring for performance and cost efficiency; Terraform can be used to configure monitoring solutions:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1,2]; title: ; notranslate">
resource &quot;databricks_instance_profile&quot; &quot;monitoring&quot; {
 instance_profile_arn = &quot;arn:aws:iam::123456789012:instance-profile/DatabricksMonitor&quot;
}
Autoscaling is enabled on the clusters to optimize resource utilization without over-provisioning:
autoscale {
 min_workers = 4
 max_workers = 16
}
</pre></div>


<h2 class="wp-block-heading"><a></a>Errors and debugging Terraform Deployments</h2>



<p class="">Some common Terraform errors include authentication failures and state mismatches. Provider authentication issues can be resolved by verifying permissions and credentials. State mismatches often require manual state adjustments:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [1]; title: ; notranslate">
terraform state rm databricks_cluster.example
terraform apply
</pre></div>


<p class="">Quota restrictions and API rate limits must be handled by adjusting Terraform configurations to include retries and back-off mechanisms.</p>



<h2 class="wp-block-heading"><a></a>Databricks Deployments Optimization.</h2>



<p class="">More resources like <a href="https://www.databricks.com/product/unity-catalog">Unity Catalog </a>for data governance can be managed with Terraform:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: yaml; gutter: false; highlight: [2]; title: ; notranslate">
resource &quot;databricks_metastore&quot; &quot;unity&quot; {
 name = &quot;example-metastore&quot;
}
</pre></div>


<p class=""><a href="https://mlflow.org/">MLflow</a> tracking servers can also be set up to manage ML models and notebooks through Git integration, ensuring streamlined workflows.</p>



<p class="">This tutorial has shown how to automate Databricks infrastructure with Terraform, including infra provisioning, access control, job automation, CI/CD integration, and monitoring, but more optimizations like cost management, security best practices, and additional Databricks features can be included.</p>



<p class="has-background" style="background-color:#beefca"><strong>Pro tips:</strong><br>1. Follow this <a href="https://azureops.org/articles/manage-secret-scopes-in-databricks-using-gui/" target="_blank" rel="noreferrer noopener">guide </a>to know how to manage secret scopes in databricks.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>



<p class=""></p>
<p>The post <a href="https://azureops.org/articles/automate-databricks-infrastructure-as-code-with-terraform/">Automate Databricks Infrastructure as Code with Terraform</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8414</post-id>	</item>
		<item>
		<title>Deploy DACPAC to Azure SQL Database</title>
		<link>https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Wed, 01 Jan 2025 07:56:13 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DevOps]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[dacpac]]></category>
		<category><![CDATA[dacpac sql server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8224</guid>

					<description><![CDATA[<p>This guide will walk you through the process of deploy DACPAC to Azure SQL database directly from Visual Studio. </p>
<p>The post <a href="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/">Deploy DACPAC to Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Deploying a DACPAC to an Azure SQL Database is a critical step in ensuring your database changes are effectively moved from development to production. This guide will walk you through the process of deploy DACPAC to Azure SQL database directly from Visual Studio. </p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites:</strong><br>1. <a href="https://visualstudio.microsoft.com/downloads/" target="_blank" rel="noreferrer noopener">Visual Studio</a> with data tools installed on your system.<br>2. An Azure SQL Database set up and accessible.<br>3. A DACPAC file ready for deployment.</p>



<h2 class="wp-block-heading">Create a DACPAC File</h2>



<p class="">In this <a href="https://azureops.org/articles/dacpac-sql-server-database/" target="_blank" rel="noreferrer noopener">post</a>, we cover the process of creating a DACPAC file, a critical artifact that encapsulates the schema and objects of a SQL Server database. Learn how to build and validate your DACPAC files to ensure seamless deployments.</p>



<h2 class="wp-block-heading">Open a DACPAC File in Visual Studio</h2>



<p class="">Discover how to open and inspect a DACPAC file in Visual Studio. This <a href="https://azureops.org/articles/how-to-open-dacpac-file-in-visual-studio/" target="_blank" rel="noreferrer noopener">guide </a>provides details of how to open DACPAC file in Visual Studio.</p>



<h2 class="wp-block-heading">Deploy DACPAC to Azure SQL Database from Visual Studio</h2>



<p class="">Follow the below steps to deploy the DACPAC project from visual Studio. You can follow the same below steps to deploy database project to any SQL Server database or Azure Managed Instance. Make sure to select correct target platform and provide applicable connection details.</p>



<h4 class="wp-block-heading">1. Open Visual Studio</h4>



<ol start="1" class="wp-block-list">
<li class="">Launch Visual Studio and open your solution or project.</li>



<li class="">Ensure you have the <strong>SQL Server Data Tools (SSDT)</strong> installed.</li>
</ol>



<h4 class="wp-block-heading">2. Change target platform of database project</h4>



<ol class="wp-block-list">
<li class="">Right-click on database project and click properties. </li>



<li class="">Change the Target platform to Microsoft Azure SQL Database as shown in the below image. </li>
</ol>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="753" height="203" data-attachment-id="8247" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/image-28/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?fit=753%2C203&amp;ssl=1" data-orig-size="753,203" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?fit=753%2C203&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=753%2C203&#038;ssl=1" alt="Change target platform of SQL database project. " class="wp-image-8247" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?w=753&amp;ssl=1 753w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=300%2C81&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=450%2C121&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image.png?resize=600%2C162&amp;ssl=1 600w" sizes="(max-width: 753px) 100vw, 753px" /></a></figure>



<h4 class="wp-block-heading">3. Publish the Database Project</h4>



<p class="">Right-click on the project and select <strong>Publish</strong> from the context menu.</p>



<p class="">In <strong>Solution Explorer</strong>, locate your database project.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="555" height="461" data-attachment-id="8227" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/select-dacpac-project-for-deployment/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?fit=555%2C461&amp;ssl=1" data-orig-size="555,461" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select DACPAC project for deployment" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?fit=555%2C461&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=555%2C461&#038;ssl=1" alt="publish dacpac file from Visual Studio" class="wp-image-8227" style="width:406px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?w=555&amp;ssl=1 555w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=300%2C249&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Select-DACPAC-project-for-deployment.jpg?resize=450%2C374&amp;ssl=1 450w" sizes="(max-width: 555px) 100vw, 555px" /></a></figure>



<h4 class="wp-block-heading">4. Configure the Deployment Target</h4>



<p class="">1. In the <strong>Publish Database</strong> dialog, click <strong>Edit</strong> to specify the target database.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="835" height="374" data-attachment-id="8228" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/edit-target-server-credentials/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?fit=835%2C374&amp;ssl=1" data-orig-size="835,374" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Edit target server credentials" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?fit=835%2C374&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=835%2C374&#038;ssl=1" alt="Create Azure SQL database connection for dacpac deployment " class="wp-image-8228" style="width:558px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?w=835&amp;ssl=1 835w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=300%2C134&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=768%2C344&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=450%2C202&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Edit-target-server-credentials.jpg?resize=600%2C269&amp;ssl=1 600w" sizes="(max-width: 835px) 100vw, 835px" /></a></figure>



<p class="">2. In the <strong>Edit Target Database Connection</strong> window:</p>



<ul class="wp-block-list">
<li class="">Select <strong>Azure SQL Database</strong> as the target.</li>



<li class="">Enter the server name, authentication details, and select the target database.</li>



<li class="">Test the connection to ensure it is valid.</li>



<li class="">Click <strong>OK</strong> to confirm.</li>
</ul>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="879" height="645" data-attachment-id="8229" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/provide-target-server-and-database-details/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?fit=879%2C645&amp;ssl=1" data-orig-size="879,645" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Provide target server and database details" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?fit=879%2C645&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=879%2C645&#038;ssl=1" alt="Deploy DACPAC to Azure SQL Database" class="wp-image-8229" style="width:555px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?w=879&amp;ssl=1 879w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=300%2C220&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=845%2C620&amp;ssl=1 845w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=768%2C564&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=450%2C330&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Provide-target-server-and-database-details.jpg?resize=600%2C440&amp;ssl=1 600w" sizes="(max-width: 879px) 100vw, 879px" /></a></figure>



<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h4 class="wp-block-heading">5. Review and Publish</h4>



<p class="">1. Back in the <strong>Publish Database</strong> dialog, review the settings to ensure the correct DACPAC file and target database are selected.</p>



<p class="">2. Optionally, click <strong>Advanced</strong> to configure deployment options such as excluding certain schema changes as shown in the below image.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="507" height="639" data-attachment-id="8250" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/image-29/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?fit=507%2C639&amp;ssl=1" data-orig-size="507,639" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?fit=507%2C639&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=507%2C639&#038;ssl=1" alt="" class="wp-image-8250" style="width:378px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?w=507&amp;ssl=1 507w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=238%2C300&amp;ssl=1 238w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=492%2C620&amp;ssl=1 492w, https://i0.wp.com/azureops.org/wp-content/uploads/2025/01/image-1.png?resize=450%2C567&amp;ssl=1 450w" sizes="(max-width: 507px) 100vw, 507px" /></a></figure>



<p class="">3. Click <strong>Publish</strong> to start the deployment process.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="683" height="344" data-attachment-id="8230" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/click-publish-dapac-project-to-azure-sql/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?fit=683%2C344&amp;ssl=1" data-orig-size="683,344" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;1&quot;}" data-image-title="Click publish dapac project to azure sql" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?fit=683%2C344&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=683%2C344&#038;ssl=1" alt="Deploy DACPAC to Azure SQL Database" class="wp-image-8230" style="width:535px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?w=683&amp;ssl=1 683w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=300%2C151&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=450%2C227&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/Click-publish-dapac-project-to-azure-sql.jpg?resize=600%2C302&amp;ssl=1 600w" sizes="(max-width: 683px) 100vw, 683px" /></a></figure>



<h4 class="wp-block-heading">6. Monitor and Verify Deployment</h4>



<ol start="1" class="wp-block-list">
<li class="">Monitor the progress of dacpac publish in Visual Studio as shown in the below image.</li>



<li class="">Once the deployment is complete, open <strong>SQL Server Management Studio (SSMS)</strong> or use Visual Studio’s built-in tools to verify the schema changes in your Azure SQL Database.</li>



<li class="">Run test queries to confirm the database is functioning as expected.</li>
</ol>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="677" height="90" data-attachment-id="8231" data-permalink="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/monitor-the-progress-of-deployment/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?fit=677%2C90&amp;ssl=1" data-orig-size="677,90" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="monitor the progress of deployment" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?fit=677%2C90&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=677%2C90&#038;ssl=1" alt="" class="wp-image-8231" style="width:581px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?w=677&amp;ssl=1 677w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=300%2C40&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=450%2C60&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/monitor-the-progress-of-deployment.jpg?resize=600%2C80&amp;ssl=1 600w" sizes="(max-width: 677px) 100vw, 677px" /></a></figure>



<p class="has-background" style="background-color:#bcefca"><strong>Pro tips:</strong><br>1. Refer to this <a href="https://azureops.org/articles/implement-azure-sql-database-deployment-ci-cd-pipeline/" target="_blank" rel="noreferrer noopener">post </a>if you wish to Automate Azure SQL Database deployment using Azure DevOps CICD pipeline.<br>2. If you skip target platform change step during the deployment, you may get an error &#8220;A project which specifies SQL Server 2022 or Azure SQL Database Managed Instance as the target platform cannot be published to Microsoft Azure SQL Database v12.&#8221;. Refer to this <a href="https://azureops.org/articles/a-project-which-specifies-sql-server-2022-or-azure-sql-database-managed-instance-as-the-target-platform-cannot-be-published-to-microsoft-azure-sql-database-v12/" target="_blank" rel="noreferrer noopener">post </a>to learn more about it.<br>3. Test your DACPAC deployment on a local environment before pushing it to Azure.<br>4. Always take a backup of your target Azure SQL Database before deployment.<br>5. Use tools like SQL Compare to identify schema differences between the DACPAC and the target database.<br></p>



<h2 class="wp-block-heading">FAQ</h2>


<div class="wp-block-uagb-faq uagb-faq__outer-wrap uagb-block-f06236a7 uagb-faq-icon-row uagb-faq-layout-accordion uagb-faq-expand-first-true uagb-faq-inactive-other-true uagb-faq__wrap uagb-buttons-layout-wrap uagb-faq-equal-height     " data-faqtoggle="true" role="tablist"><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-3becbfb9 " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">1. How do I deploy a DACPAC using SSMS?</span></div><div class="uagb-faq-content"><p>In SQL Server Management Studio, right-click the target database → Tasks → Deploy Data-tier Application → select your DACPAC file.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-e5bcb60d " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">2. Can I deploy a DACPAC using command line?</span></div><div class="uagb-faq-content"><p>Yes. Use the <code>sqlpackage.exe /Action:Publish /SourceFile:mydb.dacpac /TargetConnectionString:"..."</code> command.</p></div></div><div class="wp-block-uagb-faq-child uagb-faq-child__outer-wrap uagb-faq-item uagb-block-dfafc55e " role="tab" tabindex="0"><div class="uagb-faq-questions-button uagb-faq-questions">			<span class="uagb-icon uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M432 256c0 17.69-14.33 32.01-32 32.01H256v144c0 17.69-14.33 31.99-32 31.99s-32-14.3-32-31.99v-144H48c-17.67 0-32-14.32-32-32.01s14.33-31.99 32-31.99H192v-144c0-17.69 14.33-32.01 32-32.01s32 14.32 32 32.01v144h144C417.7 224 432 238.3 432 256z"></path></svg>
							</span>
						<span class="uagb-icon-active uagb-faq-icon-wrap">
								<svg xmlns="https://www.w3.org/2000/svg" viewBox= "0 0 448 512"><path d="M400 288h-352c-17.69 0-32-14.32-32-32.01s14.31-31.99 32-31.99h352c17.69 0 32 14.3 32 31.99S417.7 288 400 288z"></path></svg>
							</span>
			<span class="uagb-question">3. What errors are common during DACPAC deployment?</span></div><div class="uagb-faq-content"><p>Common issues include schema conflicts, missing permissions, and version mismatches. Use <code>/p:BlockOnPossibleDataLoss=false</code> carefully if schema changes drop objects.</p></div></div></div>


<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/deploy-dacpac-to-azure-sql-database/">Deploy DACPAC to Azure SQL Database</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8224</post-id>	</item>
		<item>
		<title>Create Python Azure function in Visual Studio Code</title>
		<link>https://azureops.org/articles/create-python-azure-function/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 07 Nov 2024 16:38:45 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Function]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[azure function]]></category>
		<category><![CDATA[python azure function]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=7939</guid>

					<description><![CDATA[<p>Azure Functions is a serverless computing service that enables developers to deploy small pieces of code without the need to manage the underlying infrastructure. It supports various programming languages, including .NET, Python, JavaScript, TypeScript, Java, PowerShell, and C#, providing flexibility and versatility for various applications. This article describes how to create Python Azure function in [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/create-python-azure-function/">Create Python Azure function in Visual Studio Code</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Azure Functions is a serverless computing service that enables developers to deploy small pieces of code without the need to manage the underlying infrastructure. It supports various programming languages, including .NET, Python, JavaScript, TypeScript, Java, PowerShell, and C#, providing flexibility and versatility for various applications. This article describes how to create Python Azure function in Visual Studio code.</p>



<p class="has-pale-cyan-blue-background-color has-background"><strong>Prerequisites:</strong><br>1. <a href="https://code.visualstudio.com/download" target="_blank" rel="noreferrer noopener">Visual Studio Code</a> installed on your machine. <br>2. <strong>Azure Functions Core Tools</strong> installed. This can be installed via <a href="https://nodejs.org/">Node.js</a> or the <code>npm install -g azure-functions-core-tools</code> command.<br>3. <strong>Python Interpreter</strong> (Ensure Python 3.8 or later is installed, preferably the latest version). Install it from Microsoft Store.<br>4. <strong>Azure Account</strong> with an active subscription. If you don’t have one, create a free Azure account at <a href="https://azure.microsoft.com/free/">Azure Free Account</a>.<br>4. <strong>Azure Functions Extension for Visual Studio Code</strong> installed. Install this from the Extensions marketplace in Visual Studio Code.<br>5. <strong>Azure CLI</strong> (Command Line Interface), for deploying the function.</p>



<p class=""></p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1180" height="377" data-attachment-id="7968" data-permalink="https://azureops.org/articles/create-python-azure-function/install-azure-function-extension/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?fit=1180%2C377&amp;ssl=1" data-orig-size="1180,377" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="install-Azure-function-extension" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?fit=1180%2C377&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?resize=1180%2C377&#038;ssl=1" alt="create python azure function" class="wp-image-7968" style="width:933px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?w=1180&amp;ssl=1 1180w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?resize=300%2C96&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?resize=768%2C245&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?resize=450%2C144&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/install-Azure-function-extension.webp?resize=600%2C192&amp;ssl=1 600w" sizes="(max-width: 1180px) 100vw, 1180px" /></a></figure>



<h2 class="wp-block-heading">Follow the below steps to Create Python Azure function in Visual Studio Code</h2>



<p class="">1. Open Visual Studio Code and on the left-hand side ribbon, Click Azure Icon. A menu at the bottom will pop up. Click on the Azure function icon and click the &#8216;Create Function&#8217; menu item.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="463" height="426" data-attachment-id="7945" data-permalink="https://azureops.org/articles/create-python-azure-function/right-click-on-azure-icon-and-select-azure-function/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?fit=463%2C426&amp;ssl=1" data-orig-size="463,426" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Right-click-on-Azure-icon-and-select-Azure-function" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?fit=463%2C426&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?resize=463%2C426&#038;ssl=1" alt="" class="wp-image-7945" style="width:373px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?w=463&amp;ssl=1 463w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?resize=300%2C276&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Right-click-on-Azure-icon-and-select-Azure-function.webp?resize=450%2C414&amp;ssl=1 450w" sizes="(max-width: 463px) 100vw, 463px" /></a></figure>



<p class="">2. Select Python as a language as shown in the below image. </p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="771" height="187" data-attachment-id="7946" data-permalink="https://azureops.org/articles/create-python-azure-function/select-python-programming-language/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?fit=771%2C187&amp;ssl=1" data-orig-size="771,187" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select-Python-programming-language" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?fit=771%2C187&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?resize=771%2C187&#038;ssl=1" alt="" class="wp-image-7946" style="width:545px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?w=771&amp;ssl=1 771w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?resize=300%2C73&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?resize=768%2C186&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?resize=450%2C109&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-Python-programming-language.webp?resize=600%2C146&amp;ssl=1 600w" sizes="(max-width: 771px) 100vw, 771px" /></a></figure>



<p class="">3. Select &#8216;Model V2&#8217; as the Python programming model.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="603" height="158" data-attachment-id="7962" data-permalink="https://azureops.org/articles/create-python-azure-function/select-model-v2-2/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?fit=603%2C158&amp;ssl=1" data-orig-size="603,158" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select model V2" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?fit=603%2C158&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?resize=603%2C158&#038;ssl=1" alt="" class="wp-image-7962" style="width:546px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?w=603&amp;ssl=1 603w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?resize=300%2C79&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?resize=450%2C118&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-model-V2-1.webp?resize=600%2C157&amp;ssl=1 600w" sizes="(max-width: 603px) 100vw, 603px" /></a></figure>



<p class="">4. Select Python interpreter as the latest available version (3.11.9). </p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="573" height="171" data-attachment-id="7949" data-permalink="https://azureops.org/articles/create-python-azure-function/select-python-version/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?fit=573%2C171&amp;ssl=1" data-orig-size="573,171" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select-python-version" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?fit=573%2C171&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?resize=573%2C171&#038;ssl=1" alt="" class="wp-image-7949" style="width:543px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?w=573&amp;ssl=1 573w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?resize=300%2C90&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-python-version.webp?resize=450%2C134&amp;ssl=1 450w" sizes="(max-width: 573px) 100vw, 573px" /></a></figure>



<p class="">5. Select the type of trigger you want to use for this function. In our case, we will use the Time trigger. Provide a <strong>CRON Expression</strong> (e.g., <code>0 */5 * * * *</code> for every 5 minutes) to schedule the timer trigger.</p>



<figure class="wp-block-image size-full is-resized"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="686" height="222" data-attachment-id="7951" data-permalink="https://azureops.org/articles/create-python-azure-function/select-trigger-type/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?fit=686%2C222&amp;ssl=1" data-orig-size="686,222" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Select-trigger-type" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?fit=686%2C222&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?resize=686%2C222&#038;ssl=1" alt="create python azure function" class="wp-image-7951" style="width:542px;height:auto" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?w=686&amp;ssl=1 686w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?resize=300%2C97&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?resize=450%2C146&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2024/07/Select-trigger-type.webp?resize=600%2C194&amp;ssl=1 600w" sizes="(max-width: 686px) 100vw, 686px" /></a></figure>



<p class="">6. Once the above steps are complete, Visual Studio Code will generate a Python Azure Function template with a pre-defined structure. Open the <code>__init__.py</code> file and add the desired logic for your function.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: python; title: ; notranslate">
import datetime
import logging

import azure.functions as func

def main(mytimer: func.TimerRequest) -&gt; None:
    utc_timestamp = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc).isoformat()

    if mytimer.past_due:
        logging.warning(&#039;The timer is past due!&#039;)

    logging.info(f&#039;Python timer trigger function ran at {utc_timestamp}&#039;)

</pre></div>


<h2 class="wp-block-heading">Debugging Your Function Locally</h2>



<ol class="wp-block-list">
<li class="">Press <code>F5</code> or click on the <strong>Run and Debug</strong> option in Visual Studio Code.</li>



<li class="">Azure Core Tools will emulate the function runtime locally, allowing you to test the functionality.</li>
</ol>



<h2 class="wp-block-heading">Deploying the Function to Azure</h2>



<ol class="wp-block-list">
<li class="">Click on the <strong>Azure Icon</strong> in Visual Studio Code.</li>



<li class="">Sign in to your Azure account if not already done.</li>



<li class="">Right-click on the <strong>Functions</strong> node and select <strong>Deploy to Function App</strong>.</li>



<li class="">Follow the prompts to create or choose an Azure Function App in your subscription.</li>
</ol>



<p class="">We have seen how to create Python Azure function in Visual Studio Code.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/create-python-azure-function/">Create Python Azure function in Visual Studio Code</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">7939</post-id>	</item>
		<item>
		<title>Parse JSON in SQL Server</title>
		<link>https://azureops.org/articles/parse-json-in-sql-server/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Thu, 17 Oct 2024 16:29:43 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[SQL Database]]></category>
		<category><![CDATA[SQL Server]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=8180</guid>

					<description><![CDATA[<p>JSON (JavaScript Object Notation) is a lightweight data-interchange format that has become a standard for data exchange in web and database applications. With the rise of JSON&#8217;s popularity, SQL Server introduced built-in support for JSON starting with SQL Server 2016. In this article, we will explore how to parse JSON in SQL Server and extract [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/parse-json-in-sql-server/">Parse JSON in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">JSON (JavaScript Object Notation) is a lightweight data-interchange format that has become a standard for data exchange in web and database applications. With the rise of JSON&#8217;s popularity, SQL Server introduced built-in support for JSON starting with <a href="https://azureops.org/articles/tag/sql-server-2025-preview/" target="_blank" rel="noreferrer noopener">SQL Server</a> 2016. In this article, we will explore how to parse JSON in SQL Server and extract meaningful data with practical examples.</p>



<h2 class="wp-block-heading">Why JSON in SQL Server?</h2>



<p class="">JSON allows applications to exchange structured data with simplicity and efficiency. SQL Server’s JSON support makes it easy to:</p>



<ol start="1" class="wp-block-list">
<li class="">Store JSON data in table columns.</li>



<li class="">Query JSON data directly from the database.</li>



<li class="">Transform JSON data into relational formats.</li>
</ol>



<p class="">The key functions provided by SQL Server for JSON manipulation include:</p>



<ul class="wp-block-list">
<li class=""><code>OPENJSON()</code>: Parses JSON text and returns objects in tabular format.</li>



<li class=""><code>JSON_VALUE()</code>: Extracts a scalar value from a JSON string.</li>



<li class=""><code>JSON_QUERY()</code>: Retrieves a JSON object or array from a JSON string.</li>
</ul>



<h2 class="wp-block-heading">How to Parse JSON in SQL Query</h2>



<p class="">Let us see various examples of parsing JSON strings in SQL Server.</p>



<h3 class="wp-block-heading">Parsing JSON with OPENJSON()</h3>



<p class="">The <code>OPENJSON()</code> function is the most versatile tool for working with JSON in SQL Server. It can parse JSON text and return a result set that can be queried like a regular table.</p>



<h4 class="wp-block-heading">Example 1: Basic JSON Parsing</h4>



<p class="">Suppose you have the following JSON stored in a variable:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
DECLARE @json NVARCHAR(MAX) =
    N&#039;{
        &quot;employees&quot;: &#x5B;
            {&quot;id&quot;: 1, &quot;name&quot;: &quot;John Doe&quot;, &quot;role&quot;: &quot;Manager&quot;},
            {&quot;id&quot;: 2, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;role&quot;: &quot;Developer&quot;}
        ]
    }&#039;;
</pre></div>


<p class="">To parse this JSON and extract the employee details, you can use <code>OPENJSON()</code> with a specified path:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT id, name, role
FROM OPENJSON(@json, &#039;$.employees&#039;)
WITH (
    id INT &#039;$.id&#039;,
    name NVARCHAR(50) &#039;$.name&#039;,
    role NVARCHAR(50) &#039;$.role&#039;
);
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="216" height="98" data-attachment-id="8185" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-23/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?fit=216%2C98&amp;ssl=1" data-orig-size="216,98" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?fit=216%2C98&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-1.png?resize=216%2C98&#038;ssl=1" alt="" class="wp-image-8185"/></a></figure>



<p class=""><strong>Explanation:</strong></p>



<ul class="wp-block-list">
<li class=""><code>'$'</code> denotes the root of the JSON object.</li>



<li class=""><code>$.employees</code> navigates to the <code>employees</code> array within the JSON.</li>



<li class="">The <code>WITH</code> clause specifies the schema for the JSON fields to be extracted.</li>
</ul>



<h3 class="wp-block-heading">Extracting Values with JSON_VALUE()</h3>



<p class="">The function is ideal if you need to extract individual values from a JSON string.</p>



<h4 class="wp-block-heading">Example 2: Extract a Specific Value</h4>



<p class="">Using the same JSON example above, you can retrieve the name of the first employee:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT JSON_VALUE(@json, &#039;$.employees&#x5B;0].name&#039;) AS FirstEmployeeName;
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="171" height="71" data-attachment-id="8186" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-24/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?fit=171%2C71&amp;ssl=1" data-orig-size="171,71" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?fit=171%2C71&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-2.png?resize=171%2C71&#038;ssl=1" alt="" class="wp-image-8186"/></a></figure>



<h3 class="wp-block-heading">Extracting Nested Objects with JSON_QUERY()</h3>



<p class="">The <code>JSON_QUERY()</code> function is used to extract complex objects or arrays from a JSON string.</p>



<h4 class="wp-block-heading">Example 3: Extract an Array</h4>



<p class="">To extract the entire <code>employees</code> array:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT JSON_QUERY(@json, &#039;$.employees&#039;) AS EmployeesArray;
</pre></div>


<figure class="is-style-default wp-block-image size-large is-resized"><a href="https://marketplace.visualstudio.com/items?itemName=AzureOps.ssiscatalogerpro&amp;ssr=false#overview" target="_blank" rel="noopener"><img data-recalc-dims="1" loading="lazy" decoding="async" width="1200" height="148" data-attachment-id="4839" data-permalink="https://azureops.org/articles/azure-data-studio-for-sql-developers/scmw-horizontal-ad/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1326%2C163&amp;ssl=1" data-orig-size="1326,163" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="SCMW-horizontal-ad" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?fit=1200%2C148&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&#038;ssl=1" alt="" class="wp-image-4839" style="object-fit:cover;width:811px;height:99px" srcset="https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=1200%2C148&amp;ssl=1 1200w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=450%2C55&amp;ssl=1 450w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=600%2C74&amp;ssl=1 600w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=300%2C37&amp;ssl=1 300w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?resize=768%2C94&amp;ssl=1 768w, https://i0.wp.com/azureops.org/wp-content/uploads/2023/01/SCMW-horizontal-ad.png?w=1326&amp;ssl=1 1326w" sizes="(max-width: 1200px) 100vw, 1200px" /></a></figure>



<h3 class="wp-block-heading">Combining JSON Functions in Queries</h3>



<p class="">You can combine these functions to manipulate and query JSON data effectively.</p>



<h4 class="wp-block-heading">Example 4: Parsing JSON Stored in a Table</h4>



<p class="">Assume you have a table named <code>EmployeeData</code> with a column <code>EmployeeJSON</code> that stores JSON strings.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
CREATE TABLE EmployeeData (
    Id INT IDENTITY PRIMARY KEY,
    EmployeeJSON NVARCHAR(MAX)
);

INSERT INTO EmployeeData (EmployeeJSON)
VALUES
(N&#039;{&quot;id&quot;: 1, &quot;name&quot;: &quot;John Doe&quot;, &quot;role&quot;: &quot;Manager&quot;}&#039;),
(N&#039;{&quot;id&quot;: 2, &quot;name&quot;: &quot;Jane Smith&quot;, &quot;role&quot;: &quot;Developer&quot;}&#039;);
</pre></div>


<p class="">To extract and display employee details:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT
    JSON_VALUE(EmployeeJSON, &#039;$.id&#039;) AS EmployeeId,
    JSON_VALUE(EmployeeJSON, &#039;$.name&#039;) AS EmployeeName,
    JSON_VALUE(EmployeeJSON, &#039;$.role&#039;) AS EmployeeRole
FROM EmployeeData;
</pre></div>


<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="291" height="90" data-attachment-id="8187" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-25/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?fit=291%2C90&amp;ssl=1" data-orig-size="291,90" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?fit=291%2C90&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-3.png?resize=291%2C90&#038;ssl=1" alt="" class="wp-image-8187"/></a></figure>



<h3 class="wp-block-heading">Parsing Complex JSON Objects</h3>



<p class="">SQL Server can handle deeply nested JSON structures. Let’s consider a more complex example:</p>



<h4 class="wp-block-heading">Example 5: Parsing Nested JSON with Arrays and Objects</h4>



<p class="">Suppose you have a JSON structure with nested objects:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
DECLARE @complexJson NVARCHAR(MAX) =
    N&#039;{
        &quot;company&quot;: {
            &quot;name&quot;: &quot;TechCorp&quot;,
            &quot;employees&quot;: &#x5B;
                {
                    &quot;id&quot;: 1,
                    &quot;name&quot;: &quot;John Doe&quot;,
                    &quot;details&quot;: {
                        &quot;role&quot;: &quot;Manager&quot;,
                        &quot;salary&quot;: 75000
                    }
                },
                {
                    &quot;id&quot;: 2,
                    &quot;name&quot;: &quot;Jane Smith&quot;,
                    &quot;details&quot;: {
                        &quot;role&quot;: &quot;Developer&quot;,
                        &quot;salary&quot;: 60000
                    }
                }
            ]
        }
    }&#039;;
</pre></div>


<p class="">To extract employee details including nested properties:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: sql; gutter: false; title: ; notranslate">
SELECT id, name, role, salary
FROM OPENJSON(@complexJson, &#039;$.company.employees&#039;)
WITH (
    id INT &#039;$.id&#039;,
    name NVARCHAR(50) &#039;$.name&#039;,
    role NVARCHAR(50) &#039;$.details.role&#039;,
    salary INT &#039;$.details.salary&#039;
);
</pre></div>


<p class=""><strong>Explanation:</strong></p>



<ul class="wp-block-list">
<li class="">The path <code>$.company.employees</code> navigates to the employees array inside the <code>company</code> object.</li>



<li class="">Nested properties like <code>role</code> and <code>salary</code> are accessed using the full JSON path (<code>$.details.role</code> and <code>$.details.salary</code>).</li>
</ul>



<p class=""><strong>Output:</strong></p>



<figure class="wp-block-image size-full"><a href="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?ssl=1"><img data-recalc-dims="1" loading="lazy" decoding="async" width="266" height="96" data-attachment-id="8192" data-permalink="https://azureops.org/articles/parse-json-in-sql-server/image-26/" data-orig-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?fit=266%2C96&amp;ssl=1" data-orig-size="266,96" data-comments-opened="0" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="image" data-image-description="" data-image-caption="" data-large-file="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?fit=266%2C96&amp;ssl=1" src="https://i0.wp.com/azureops.org/wp-content/uploads/2024/12/image-4.png?resize=266%2C96&#038;ssl=1" alt="" class="wp-image-8192"/></a></figure>



<p class="has-background" style="background-color:#bcefda"><strong>Pro tips:</strong><br>1. SQL Server’s JSON functions make it incredibly simple to parse and manipulate JSON data without requiring additional tools or complex workarounds. Whether you’re working with JSON stored in variables or tables, these functions provide powerful options for extracting and querying data.<br>2. Understanding these features simplifies JSON handling and enhances your ability to work effectively with modern data formats. Start leveraging SQL Server’s JSON capabilities in your next project to streamline your data workflows.<br>3. SQL Server 2025 private preview is announced. Read more about it <a href="https://azureops.org/articles/sql-server-2025/" target="_blank" rel="noreferrer noopener">here</a>.<br>4. If you want to improve performance of SQL Server database, you can find long running queries by following this <a href="https://azureops.org/articles/find-long-running-queries-in-azure-sql-database/" target="_blank" rel="noreferrer noopener">post</a>.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/parse-json-in-sql-server/">Parse JSON in SQL Server</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">8180</post-id>	</item>
		<item>
		<title>Databricks VACUUM Command</title>
		<link>https://azureops.org/articles/databricks-vacuum-command/</link>
		
		<dc:creator><![CDATA[Kunal Rathi]]></dc:creator>
		<pubDate>Tue, 17 Sep 2024 00:22:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Databricks]]></category>
		<guid isPermaLink="false">https://azureops.org/?p=2860</guid>

					<description><![CDATA[<p>Databricks is a unified big data processing and analytics cloud platform for transforming and processing vast volumes of data. Apache Spark is the building block of Databricks, an in-memory analytics engine for big data and machine learning. In this article, we will see how to use the Databricks VACUUM command to remove unused files from [&#8230;]</p>
<p>The post <a href="https://azureops.org/articles/databricks-vacuum-command/">Databricks VACUUM Command</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="">Databricks is a unified big data processing and analytics cloud platform for transforming and processing vast volumes of data. Apache Spark is the building block of Databricks, an in-memory analytics engine for big data and machine learning. In this article, we will see how to use the Databricks VACUUM command to remove unused files from the delta table.</p>



<h2 class="wp-block-heading">What is VACUUM in the Delta table?</h2>



<p class="">VACUUM empties all files from the table directory that are not managed by Delta and data files that are no longer in the latest state of the transaction log for the table and are older than a retention threshold.</p>



<h2 class="wp-block-heading">How to use Databricks VACUUM on Databricks Delta tables</h2>



<pre class="wp-block-preformatted">database_names_filter = "20_silver_zendesk_eg"
dbs = spark.sql(f"SHOW DATABASES LIKE '{database_names_filter}'").select("databaseName").collect()
dbs = [(row.databaseName) for row in dbs]
for database_name in dbs:
print(f"Found database: {database_name}, performing actions on all its tables..")
tables = spark.sql(f"SHOW TABLES FROM {database_name}").select("tableName").collect()
tables = [(row.tableName) for row in tables]
for table_name in tables:
print(f"performing vaccum on {table_name}")
spark.sql(f"ALTER TABLE {database_name}.{table_name} SET TBLPROPERTIES ('delta.logRetentionDuration'='interval 2 days', 'delta.deletedFileRetentionDuration'='interval 1 days')")
spark.sql(f"VACUUM {database_name}.{table_name}")
spark.sql(f"ANALYZE TABLE {database_name}.{table_name} COMPUTE STATISTICS")</pre>



<p class="">If you run&nbsp;<code>VACUUM</code>&nbsp;on a Delta table, you lose the ability to&nbsp;<a href="https://learn.microsoft.com/en-us/azure/databricks/delta/history">time-travel</a>&nbsp;back to a version older than the specified data retention period.</p>



<h2 class="wp-block-heading">See more</h2>



<iframe width="700" height="394" src="https://www.youtube.com/embed/t2h6xNVFQkc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>



<div class="wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex">
<div class="is-style-fill wp-block-button"><a class="wp-block-button__link has-white-color has-blush-light-purple-gradient-background has-text-color has-background has-link-color wp-element-button" href="https://azureops.org/product/ssis-catalog-migration-wizard-pro/" target="_blank" rel="noreferrer noopener">Download Now</a></div>
</div>
<p>The post <a href="https://azureops.org/articles/databricks-vacuum-command/">Databricks VACUUM Command</a> appeared first on <a href="https://azureops.org">AzureOps</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2860</post-id>	</item>
	</channel>
</rss>
