<?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 &#8211; SQLpowered.com</title>
	<atom:link href="https://sqlpowered.com/category/azure/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlpowered.com</link>
	<description>SQL Server + BI</description>
	<lastBuildDate>Tue, 28 Dec 2021 21:08:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://sqlpowered.com/wp-content/uploads/2020/07/FavIcon-e1594067873682-99x100.png</url>
	<title>Azure &#8211; SQLpowered.com</title>
	<link>https://sqlpowered.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Getting Tabular Object Model from Power BI XMLA Endpoint</title>
		<link>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/</link>
					<comments>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sun, 11 Apr 2021 11:08:50 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5158</guid>

					<description><![CDATA[It&#8217;s very easy to get TOM (Tabular Object Model) for datasets hosted in Power BI Service and extract various metadata from it (tables, measures, etc.). We will do it just now using a simple C# console application and download TOM for one sample dataset using Power BI User credentials. Similarly,...]]></description>
										<content:encoded><![CDATA[<p>It&#8217;s very easy to get TOM (<a href="https://docs.microsoft.com/en-us/analysis-services/tom/introduction-to-the-tabular-object-model-tom-in-analysis-services-amo?view=asallproducts-allversions" target="_blank" rel="noopener">Tabular Object Model</a>) for datasets hosted in Power BI Service and extract various metadata from it (tables, measures, etc.). We will do it just now using a simple C# console application and download TOM for one sample dataset using Power BI User credentials. Similarly, you can do that as Service Principal.</p>
<p>Let&#8217;s set up a few prerequisites first.</p>
<h3>1. Setting the Power BI Tenant</h3>
<p><strong>Note</strong>: If you don&#8217;t have a Power BI account with administrative rights then use this <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">guide</a> to create one.</p>
<p>Login to your Power BI account with administrative privileges and in Admin Portal make sure you have enabled access to XMLA endpoints for your tenant in Power BI Admin Portal.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone wp-image-5164" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002.png" alt="" width="704" height="349" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002.png 1506w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-300x149.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-1024x507.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-150x74.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-768x380.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-360x178.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-160x79.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-320x159.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-495x245.png 495w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-686x340.png 686w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-908x450.png 908w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-1009x500.png 1009w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_03-002-520x258.png 520w" sizes="(max-width: 704px) 100vw, 704px" /></p>
<p>Because we will call the XMLA endpoint as a Power BI User with Premium Per User capacity, go to the <em>Premium Per User</em> section and allow read-only access to XMLA endpoints in <em>Dataset workload settings.</em><br />
<img decoding="async" class="alignnone wp-image-5167" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04.png" alt="" width="407" height="453" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04.png 887w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-270x300.png 270w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-90x100.png 90w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-768x854.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-360x400.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-144x160.png 144w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-288x320.png 288w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-220x245.png 220w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-306x340.png 306w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-405x450.png 405w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-450x500.png 450w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_04-520x578.png 520w" sizes="(max-width: 407px) 100vw, 407px" /></p>
<p>For the Power BI Premium per Capacity settings check this <a href="https://www.youtube.com/watch?v=YEIKzeNCqGg" target="_blank" rel="noopener">video</a> from 6:48 because there it needs to be set too.</p>
<p>Then go to your workspaces and choose the one you will connect to.</p>
<p><img decoding="async" class="alignnone wp-image-5168" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06.png" alt="" width="406" height="394" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06.png 891w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-300x291.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-103x100.png 103w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-768x745.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-360x349.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-160x155.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-320x310.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-253x245.png 253w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-351x340.png 351w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-464x450.png 464w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-516x500.png 516w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_06-520x504.png 520w" sizes="(max-width: 406px) 100vw, 406px" /></p>
<p>Copy the Workspace connection because we will use it later in the C# Console app.</p>
<p><strong>Note</strong>: XMLA endpoints are supported only for workspaces hosted on <a href="https://docs.microsoft.com/en-us/power-bi/admin/service-premium-what-is" target="_blank" rel="noopener">Premium capacity</a>. If you will try to connect to a non-premium workspace you will get this exception:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="raw">Microsoft.AnalysisServices.ConnectionException: 
Initial catalog property is required in order to connect to Power BI Pro workspaces.</pre>
<p>You can test the proper configuration using the SQL Server Management Studio.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5170" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07.png" alt="" width="381" height="251" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07.png 873w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-300x198.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-150x100.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-768x506.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-360x237.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-160x105.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-320x211.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-372x245.png 372w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-516x340.png 516w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-683x450.png 683w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-759x500.png 759w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_07-520x342.png 520w" sizes="auto, (max-width: 381px) 100vw, 381px" /></p>
<p>Fill in your Power BI User account credentials (same as for powerbi.com) once prompted. You will see a list of available databases after successful authentication.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5175" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08.png" alt="" width="638" height="55" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08.png 1091w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-300x26.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-1024x88.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-150x13.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-768x66.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-360x31.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-160x14.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-320x28.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-520x45.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-720x62.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_08-980x84.png 980w" sizes="auto, (max-width: 638px) 100vw, 638px" /></p>
<h3>2. Downloading Tabular Object Model using C# console application</h3>
<p>Because our Power BI XMLA endpoint is ready for connection now, we will test it from a simple C# console application. You can build your own or just download the solution targeting .NET.Core 5.0.</p>
<ul>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIXMLA.zip">PowerBIXMLA</a></li>
</ul>
<p>Two NuGet packages are required to connect to Analysis Services running under the hood of Power BI Service.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5161" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01.png" alt="" width="751" height="112" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01.png 1617w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-300x45.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1024x153.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-150x22.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-768x114.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1536x229.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-360x54.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-160x24.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-320x48.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-520x78.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-720x107.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-980x146.png 980w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_01-1320x197.png 1320w" sizes="auto, (max-width: 751px) 100vw, 751px" /></p>
<p>The main method:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using System;
using Microsoft.AnalysisServices;

namespace PowerBIXMLA
{
    class Program
    {
        static void Main(string[] args)
        {

            Server server = new Server();

            // Connect as Power BI User
            string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME";
            string userId = "";
            string password = "";
            string connectStringUser = $"DataSource={workspaceConnection};User ID={userId};Password={password};";


            // Connect as Service Principal
            /*
            string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME";
            string tenantId = "";
            string appId = "";
            string appSecret = "";
            string connectStringServicePrincipal = $"DataSource={workspaceConnection};User ID=app:{appId}@{tenantId};Password={appSecret};";
            */

            // Connect
            server.Connect(connectStringUser);

            // List Databases (Datasets - tabular models) and extract TOM (Tabular Object Model)
            foreach (Database database in server.Databases)
            {
                Console.WriteLine(database.Name);

                string tmslTable = JsonSerializer.SerializeDatabase(database);

                Console.WriteLine(tmslTable);
            }
        }
    }
}</pre>
<p>You need to modify the section with Power BI User credentials:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">string workspaceConnection = "powerbi://api.powerbi.com/v1.0/myorg/YOUR_WORSPACE_NAME"; 
string userId = ""; 
string password = "";</pre>
<ul>
<li><strong>worskspaceConnection</strong>: this is the <em>Workspace Connection</em> value we have copied above (powerbi://api.powerbi.com/v1.0/myorg/Premium WS)</li>
<li><strong>userId</strong>: Power BI User account name (username@domain.xx). The same you are using to sign in to Power BI Service.</li>
<li><strong>password</strong>: Your Power BI User password.</li>
</ul>
<p>We can list all server <em>Databases</em> once connected and use the <em>SerializeDatabase()</em> method to get the Tabular Object Model.</p>
<p>Rebuild the application and run int. In case of success you will see:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5163" src="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02.png" alt="" width="437" height="407" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02.png 816w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-300x280.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-107x100.png 107w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-768x716.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-360x336.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-160x149.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-320x298.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-263x245.png 263w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-365x340.png 365w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-483x450.png 483w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-536x500.png 536w, https://sqlpowered.com/wp-content/uploads/2021/04/Getting_TOM_from_Power_BI_XMLA_Endpoint_02-520x485.png 520w" sizes="auto, (max-width: 437px) 100vw, 437px" /></p>
<p>Because we have called the <em>SerializeDatabase()</em> method the whole Database is serialized to JSON. Database-level properties are marked with blue. The Tabular Object Model is marked with green.</p>
<p>If you would like to serialize just the Tabular Object Model you can call SerializaeObject() method inside the Tabular namespace.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">Microsoft.AnalysisServices.Tabular.JsonSerializer.SerializeObject(database.Model);</pre>
<p>To do more with the main Tabular Object Model just reference the Tabular namespace and process the object like any other strong-typed objects.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using Microsoft.AnalysisServices.Tabular;
...

Model model = database.Model;

foreach (Table t in model.Tables)
{
    Console.WriteLine(t.Name);
}
</pre>
<p>Finally, it&#8217;s important to understand that datasets uploaded to Power BI Service from Power BI *.pbix files are in fact hosted as standard Analysis Service Tabular Models in the Power BI Service. That means that you can use the same approach when connecting to the on-prem Tabular Analysis Services instance. Only the authentication process will be different. The XMLA itself is fully compatible.</p>
<h4>References</h4>
<ul>
<li><a href="https://docs.microsoft.com/en-us/power-bi/admin/service-premium-connect-tools" target="_blank" rel="noopener">Dataset connectivity with the XMLA endpoint</a></li>
<li><a href="https://docs.microsoft.com/en-us/analysis-services/tom/introduction-to-the-tabular-object-model-tom-in-analysis-services-amo?view=asallproducts-allversions" target="_blank" rel="noopener">Tabular Object Model (TOM)</a></li>
<li><a href="https://powerbidevcamp.powerappsportals.com/sessions/session04/" target="_blank" rel="noopener">Programing Datasets using the Tabular Object Model</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/getting-tabular-object-model-from-power-bi-xmla-endpoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Accessing the Power BI Admin API as Service Principal</title>
		<link>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/</link>
					<comments>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/#comments</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Mon, 05 Apr 2021 09:32:00 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5095</guid>

					<description><![CDATA[End of the year 2020 Microsoft extended the Power BI Service API with new admin access-related endpoints and added the option to use Service Principal instead of a dedicated administrative account for connection. You can read more details on it in this official Power BI  Blog post. In this step-by-step...]]></description>
										<content:encoded><![CDATA[<p>End of the year 2020 Microsoft extended the Power BI Service API with new admin access-related endpoints and added the option to use Service Principal instead of a dedicated administrative account for connection. You can read more details on it in this official <a href="https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning/" target="_blank" rel="noopener">Power BI  Blog post</a>.</p>
<p>In this step-by-step tutorial, I will do the following:</p>
<ol>
<li>Configure an Azure Application.</li>
<li>Test the Application for successful connection to Azure AD.</li>
<li>Configure Power BI Tenant to allow Service Principals to read the new Admin API.</li>
<li>Connect to the Power BI tenant and print a list of Workspaces to check that everything is configured properly.</li>
</ol>
<p><strong>Prerequisites:</strong></p>
<ul>
<li>Active Azure Portal subscription. You can <a href="https://azure.microsoft.com/en-us/free" target="_blank" rel="noopener">create one for free</a>.</li>
<li>Power BI Service tenant and account with administrative privileges. You can use this simple <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">tutorial </a>to configure it.</li>
<li>Downloaded and running <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> that we will be used for testing of the whole solution.</li>
</ul>
<p>Let&#8217;s start the challenge!</p>
<h3>1. Configure an Azure Application</h3>
<p>In the main Azure Portal menu navigate to <em>the Azure Active Directory</em> item and select <em>App registration.</em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5140" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01.png" alt="" width="331" height="414" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01.png 798w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-240x300.png 240w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-80x100.png 80w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-768x961.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-360x451.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-128x160.png 128w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-256x320.png 256w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-196x245.png 196w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-272x340.png 272w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-359x450.png 359w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-399x500.png 399w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_01-520x651.png 520w" sizes="auto, (max-width: 331px) 100vw, 331px" /></p>
<p>Start <em>New registration</em> of an Application.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5139" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03.png" alt="" width="612" height="171" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03.png 1294w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-300x84.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-1024x286.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-150x42.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-768x214.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-360x100.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-160x45.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-320x89.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-520x145.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-720x201.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_03-980x273.png 980w" sizes="auto, (max-width: 612px) 100vw, 612px" /></p>
<p>On the main registration screen please choose the application name. In our case, we will call the application <strong>SPW API Reader APP</strong>. You can keep default values for the rest of the form.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5138" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04.png" alt="" width="612" height="528" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04.png 1355w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-300x259.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-1024x883.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-116x100.png 116w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-768x663.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-360x311.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-160x138.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-320x276.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-284x245.png 284w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-394x340.png 394w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-522x450.png 522w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-580x500.png 580w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_04-520x449.png 520w" sizes="auto, (max-width: 612px) 100vw, 612px" /></p>
<p>Press the <em>Register</em> button and wait for the deployment to finish. The <em>Overview</em> page will show us two important values identifying our Application which will be used later.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5137" src="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46.png" alt="" width="551" height="217" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46.png 1175w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-300x118.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-1024x403.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-150x59.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-768x303.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-360x142.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-160x63.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-320x126.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-520x205.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-720x284.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-02.04.2021-22_48_46-980x386.png 980w" sizes="auto, (max-width: 551px) 100vw, 551px" /></p>
<ul>
<li><strong>Application (client ID)</strong> is the unique identification of the Application.</li>
<li><strong>Directory (tenant) ID</strong> is the unique identification of our tenant (organization).</li>
</ul>
<p>Both these IDs are needed for Azure Active Directory access via the OAuth protocol. Because they are like &#8220;user&#8221; names we also must create a password. Navigate to the <em>Certificates &amp; secrets </em>in the menu and press the <em>New client secret</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5136" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05.png" alt="" width="631" height="520" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05.png 1459w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-300x247.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-1024x844.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-121x100.png 121w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-768x633.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-110x90.png 110w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-360x297.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-160x132.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-320x264.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-297x245.png 297w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-413x340.png 413w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-546x450.png 546w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-607x500.png 607w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_05-520x428.png 520w" sizes="auto, (max-width: 631px) 100vw, 631px" /></p>
<p>Add a secret name and choose the expiration that fits your needs. Press Add button and a new Client Secret will be created.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5135" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06.png" alt="" width="175" height="204" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06.png 364w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-258x300.png 258w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-86x100.png 86w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-360x419.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-137x160.png 137w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-275x320.png 275w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-210x245.png 210w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_06-292x340.png 292w" sizes="auto, (max-width: 175px) 100vw, 175px" /></p>
<p><strong>You must copy the Value of the secret now!</strong> On the next page refresh, the Copy icon will disappear and the secret value can&#8217;t be copied again. You must delete the secret then and create a new one.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5134" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07.png" alt="" width="845" height="156" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07.png 1771w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-300x55.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1024x189.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-150x28.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-768x142.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1536x284.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-360x66.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-160x30.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-320x59.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-520x96.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-720x133.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-980x181.png 980w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_07-1320x244.png 1320w" sizes="auto, (max-width: 845px) 100vw, 845px" /></p>
<p>Because the Power BI Admin API allows only the Service Principal to be an Azure AD Group, we will create a new Group and assign our Application to it. Go back to Azure Active Directory and navigate to Groups.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5133" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08.png" alt="" width="351" height="265" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08.png 799w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-300x226.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-133x100.png 133w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-768x580.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-360x272.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-160x121.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-320x242.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-325x245.png 325w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-451x340.png 451w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-596x450.png 596w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-663x500.png 663w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_08-520x392.png 520w" sizes="auto, (max-width: 351px) 100vw, 351px" /></p>
<p>Press the <em>New group</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5131" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10.png" alt="" width="517" height="169" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10.png 1019w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-300x98.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-150x49.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-768x251.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-360x118.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-320x105.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-520x170.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-720x235.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_10-980x320.png 980w" sizes="auto, (max-width: 517px) 100vw, 517px" /></p>
<p>Create a new Group. Choose <em>Security</em> Group type and some meaningful Group name that you can later search for it easy.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5132" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09.png" alt="" width="555" height="440" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09.png 1176w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-300x238.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-1024x812.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-126x100.png 126w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-768x609.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-360x285.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-160x127.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-320x254.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-309x245.png 309w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-429x340.png 429w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-568x450.png 568w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-631x500.png 631w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_09-520x412.png 520w" sizes="auto, (max-width: 555px) 100vw, 555px" /></p>
<p>Once the Group is created navigate to it and click the Group name.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5130" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11.png" alt="" width="611" height="109" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11.png 1003w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-300x54.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-150x27.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-768x137.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-360x64.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-160x29.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-320x57.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-520x93.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-720x128.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_11-980x175.png 980w" sizes="auto, (max-width: 611px) 100vw, 611px" /></p>
<p>Press the <em>Add members</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5129" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12.png" alt="" width="518" height="260" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12.png 977w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-300x151.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-150x75.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-768x386.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-360x181.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-160x80.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-320x161.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-488x245.png 488w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-677x340.png 677w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-895x450.png 895w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_12-520x261.png 520w" sizes="auto, (max-width: 518px) 100vw, 518px" /></p>
<p>In the search box try to search for the name of our Application and then select the proper item filtered that it will move to the <em>Selected items</em> section.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5128" src="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55.png" alt="" width="465" height="314" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55.png 970w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-300x203.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-148x100.png 148w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-768x519.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-360x243.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-160x108.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-320x216.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-362x245.png 362w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-503x340.png 503w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-665x450.png 665w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-739x500.png 739w, https://sqlpowered.com/wp-content/uploads/2021/04/Screenshot-03.04.2021-0_43_55-520x352.png 520w" sizes="auto, (max-width: 465px) 100vw, 465px" /></p>
<p>Double-check that our Application is a member of the Group now.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5127" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13.png" alt="" width="361" height="213" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13.png 807w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-300x177.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-768x453.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-360x212.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-160x94.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-320x189.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-415x245.png 415w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-576x340.png 576w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-763x450.png 763w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_13-520x307.png 520w" sizes="auto, (max-width: 361px) 100vw, 361px" /></p>
<p>You have successfully:</p>
<ul>
<li>created new Azure Application</li>
<li>obtained unique Application ID, Tenant ID, and Application Secret values</li>
<li>created a new Azure Active Directory group and assigned the Application to be a member of it</li>
</ul>
<h3>2. Test the Application for successful connection to Azure AD.</h3>
<p>It&#8217;s time to test that the Application can successfully connect to Azure Active Directory and obtain a valid security token. This is the must-have step before we can try to access the Power BI Admin API itself.</p>
<p>To do this please download the <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> utility and check the post for details on how it works. Try to connect and obtain the security token. You can continue this tutorial once done.</p>
<p><em>Note:</em> You can also try to test the Power BI Admin API connection using the utility but it will fail with <em>Unauthorized</em> because our Application doesn&#8217;t have access to the Power BI Admin API now.</p>
<h3>3. Configure Power BI Tenant to allow Service Principals to read the new Admin API.</h3>
<p>Please login to the <a href="https://powerbi.microsoft.com" target="_blank" rel="noopener">Power BI Service</a> with an account with administrative privileges. If you will use an account without tenant-level administrative rights the <em>Tenant settings</em> section in the Admin portal is hidden at all. You can create a new Power BI Administrator or assign an existing user to the <em>Power BI administrator</em> role following this <a href="https://sqlpowered.com/create-a-new-power-bi-administrator/" target="_blank" rel="noopener">post</a>.</p>
<p>Once done navigate in the Power BI menu to the <em>Admin portal</em> section and then select <em>Tenant settings.</em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5126" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14.png" alt="" width="343" height="232" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14.png 753w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-300x203.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-148x100.png 148w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-360x243.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-160x108.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-320x216.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-362x245.png 362w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-503x340.png 503w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-666x450.png 666w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-740x500.png 740w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_14-520x352.png 520w" sizes="auto, (max-width: 343px) 100vw, 343px" /></p>
<p>Scroll down and find the <em>Admin API settings</em> section. Press the <em>Enabled</em> button and then choose the <em>Specific security groups</em> option. Search for the Azure Active Directory Group we have created above where our Application is a member of it. Press the <em>Apply</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5125" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15.png" alt="" width="666" height="409" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15.png 1517w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-300x184.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-1024x629.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-150x92.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-768x472.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-360x221.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-160x98.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-320x197.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-399x245.png 399w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-553x340.png 553w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-732x450.png 732w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-814x500.png 814w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_15-520x319.png 520w" sizes="auto, (max-width: 666px) 100vw, 666px" /></p>
<p>Security settings will be applied soon. It can take up to 15 minutes but usually, it takes not more than 2 minutes for the API is accessible.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5124" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16.png" alt="" width="432" height="93" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16.png 743w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-300x65.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-150x32.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-360x78.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-160x34.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-320x69.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-520x112.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_16-720x155.png 720w" sizes="auto, (max-width: 432px) 100vw, 432px" /></p>
<p>That&#8217;s all from the configuration point of view.</p>
<h3>4. Connect to the Power BI tenant and print a list of Workspaces.</h3>
<p>It&#8217;s time to test that our Application can really access the Power BI Admin API now. We will use the <a href="https://sqlpowered.com/power-bi-api-connector-sample-application/" target="_blank" rel="noopener">Power BI API Connector</a> utility again and print a list of Tenant available Workspaces. To do this please create at least one Workspace if you have a brand new Power BI account because the API method <a href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin/groups_getgroupsasadmin" target="_blank" rel="noopener"><span class="enlighter-m3">GetGroupsAsAdmin</span>()</a> used for testing doesn&#8217;t list the default<em> My workspace</em> item.</p>
<p>Navigate to Workspaces and press the <em>Create a workspace</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5123" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17.png" alt="" width="361" height="375" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17.png 894w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-289x300.png 289w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-96x100.png 96w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-768x798.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-360x374.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-154x160.png 154w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-308x320.png 308w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-236x245.png 236w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-327x340.png 327w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-433x450.png 433w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-481x500.png 481w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_17-520x540.png 520w" sizes="auto, (max-width: 361px) 100vw, 361px" /></p>
<p>Type Workspace name and <em>Save</em> it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5122" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18.png" alt="" width="379" height="459" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18.png 891w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-247x300.png 247w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-844x1024.png 844w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-82x100.png 82w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-768x932.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-360x437.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-132x160.png 132w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-264x320.png 264w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-202x245.png 202w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-280x340.png 280w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-371x450.png 371w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-412x500.png 412w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_18-520x631.png 520w" sizes="auto, (max-width: 379px) 100vw, 379px" /></p>
<p>New Workspace should be visible in the list of available Workspaces.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5121" src="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19.png" alt="" width="311" height="183" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19.png 502w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-300x176.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-360x212.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-160x94.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-320x188.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/Accessing_the_Power_BI_Admin_API_as_Service_Principal_19-417x245.png 417w" sizes="auto, (max-width: 311px) 100vw, 311px" /></p>
<p>Run the Power BI API Connector utility again and after you will allow it to run the Power BI Admin API test it should connect successfully to your Power BI tenant, call the API and print a list of all available Workspace.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5086" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png" alt="" width="545" height="106" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png 1188w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-300x58.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-1024x199.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-150x29.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-768x149.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-360x70.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-160x31.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-320x62.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-520x101.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-720x140.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-980x191.png 980w" sizes="auto, (max-width: 545px) 100vw, 545px" /></p>
<p>As you can see our testing Workspace name is listed. There is also &#8220;Samples WS&#8221; Workspace listed to demonstrate that it&#8217;s really admin access listing all tenant Workspaces as Service Principal and not only Workspaces of the given Power BI account as if the API is accessed in the authenticated user access mode.</p>
<p>That&#8217;s it! You are done and you can continue building your own application to do something great with all the data available via the Power BI Admin API.</p>
<h3>References</h3>
<ul>
<li><a href="https://docs.microsoft.com/en-us/rest/api/power-bi/admin" target="_blank" rel="noopener">Power BI Admin REST API</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/admin/read-only-apis-service-principal-authentication</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/developer/automation/overview-of-power-bi-rest-api" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/developer/automation/overview-of-power-bi-rest-api</a></li>
<li><a href="https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning" target="_blank" rel="noopener">https://powerbi.microsoft.com/en-us/blog/announcing-new-admin-apis-and-service-principal-authentication-to-make-for-better-tenant-metadata-scanning</a></li>
<li><a href="https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal" target="_blank" rel="noopener">https://docs.microsoft.com/en-us/power-bi/developer/embedded/embed-service-principal</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/accessing-the-power-bi-admin-api-as-service-principal/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Power BI API Connector (sample application)</title>
		<link>https://sqlpowered.com/power-bi-api-connector-sample-application/</link>
					<comments>https://sqlpowered.com/power-bi-api-connector-sample-application/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sat, 03 Apr 2021 08:50:48 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Power BI]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=5076</guid>

					<description><![CDATA[PowerBIApiConnector is a simple console application that will help you to test two things: a connection to Azure Active Directory and that you have properly configured an Azure application to access the Power BI Admin Read-Only API. Application is created in .NET.Core 5.0 and you can download it as: PowerBIApiConnector_Executable...]]></description>
										<content:encoded><![CDATA[<p>PowerBIApiConnector is a simple console application that will help you to test two things: a connection to Azure Active Directory and that you have properly configured an Azure application to access the Power BI Admin Read-Only API.</p>
<p>Application is created in .NET.Core 5.0 and you can download it as:</p>
<ul>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Executable.zip">PowerBIApiConnector_Executable</a> &#8211; executable files in *.zip package for direct use</li>
<li><a href="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.zip">PowerBIApiConnector_Solution</a> &#8211; Visual Studio 2019 Project</li>
</ul>
<h3>How to use it?</h3>
<p>Extract the executable package files to a directory. You have two options how to launch the application:</p>
<p>A) Setup parameters at the application launch:</p>
<p><code class="EnlighterJSRAW" data-enlighter-language="generic">PowerBIApiConnector.exe {Application (client) ID} {Directory (tenant) ID} {Client Secret}</code></p>
<p>B) Execute it without parameters. Then you will be prompted for input values:</p>
<p lang="cs" style="margin: 0in; font-family: Calibri; font-size: 11.0pt;"><img loading="lazy" decoding="async" class="alignnone wp-image-5080" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt.png" alt="" width="322" height="104" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt.png 604w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-300x97.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-150x48.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-360x116.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-320x103.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_InputParametersPrompt-520x168.png 520w" sizes="auto, (max-width: 322px) 100vw, 322px" /></p>
<p lang="cs">Input parameters are:</p>
<ul>
<li lang="cs"><strong>Application (client) ID</strong>: This is an Azure Application ID</li>
<li lang="cs"><strong>Directory (tenant) ID</strong>: Your organization (tenant) ID</li>
<li lang="cs"><strong>Client Secret: </strong>Application secret value<strong><br />
</strong></li>
</ul>
<p>You can get proper values for these parameters in Azure Portal: Navigate to your Application in Azure Active Directory and copy the first two parameters from the Application Overview page:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5081" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs.png" alt="" width="503" height="196" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs.png 1165w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-300x117.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-1024x399.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-150x58.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-768x299.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-360x140.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-160x62.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-320x125.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-520x203.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-720x281.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParametrs-980x382.png 980w" sizes="auto, (max-width: 503px) 100vw, 503px" /></p>
<p>For the Client Secret navigate as in the image below and copy the Value or create a new secret:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5082" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2.png" alt="" width="763" height="407" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2.png 2237w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-300x160.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-1024x547.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-150x80.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-768x410.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-1536x820.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-2048x1093.png 2048w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-360x192.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-160x85.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-320x171.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-459x245.png 459w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-637x340.png 637w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-843x450.png 843w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-937x500.png 937w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ApplicationParameters_2-520x278.png 520w" sizes="auto, (max-width: 763px) 100vw, 763px" /></p>
<p>When you launch the application and authentication to Azure AD will succeed, you will see an authentication token printed to the console window:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5085" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution.png" alt="" width="571" height="204" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution.png 1199w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-300x107.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-1024x366.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-150x54.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-768x274.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-360x129.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-160x57.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-320x114.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-520x186.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-720x257.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Execution-980x350.png 980w" sizes="auto, (max-width: 571px) 100vw, 571px" /></p>
<p>Same time you will be prompted if you would like to test the Power BI Admin Read-Only API access. You can skip this step in case you would like to test the Azure AD authentication only.</p>
<p>If you will input &#8220;Y&#8221; the GetGroupsAsAdmin() API call will be executed and when the application has properly configured access to the Power BI Admin API available tenant workspaces will be listed by name:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5086" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png" alt="" width="576" height="112" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces.png 1188w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-300x58.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-1024x199.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-150x29.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-768x149.png 768w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-360x70.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-160x31.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-320x62.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-520x101.png 520w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-720x140.png 720w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_ListWorkspaces-980x191.png 980w" sizes="auto, (max-width: 576px) 100vw, 576px" /></p>
<h3>Solution content</h3>
<p>Two dependency packages are required (will be automatically downloaded via NuGet packages manager):</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5088" src="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.png" alt="" width="299" height="184" srcset="https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution.png 493w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-300x185.png 300w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-150x92.png 150w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-360x222.png 360w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-160x99.png 160w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-320x197.png 320w, https://sqlpowered.com/wp-content/uploads/2021/04/PowerBIApiConnector_Solution-397x245.png 397w" sizes="auto, (max-width: 299px) 100vw, 299px" /></p>
<p>Main method code:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="csharp">using Microsoft.Identity.Client;
using Microsoft.PowerBI.Api;
using Microsoft.Rest;
using System.Linq;
using System;

namespace PowerBIApiConnector
{
    class Program
    {

        static PowerBIClient powerBIClient = null;
        static string accesToken = null;
        static IConfidentialClientApplication app;

        // Authentication variables
        private static string clientId;
        private static string tenantId;
        private static string clientSecret;

        // Power BI API paths
        private const string resource = "https://analysis.windows.net/powerbi/api";
        private const string ApiUrl = "https://api.powerbi.com";

        private static string authority;

        public static void Main(string[] args)
        {
            // Capture users input via prompt
            if (args.Count() == 0)
            {
                Console.WriteLine("Application (client) ID:");
                clientId = Console.ReadLine();

                Console.WriteLine("Directory (tenant) ID:");
                tenantId = Console.ReadLine();

                Console.WriteLine("Client Secret:");
                clientSecret = Console.ReadLine();
            }
            // Capture users input as launch parameters
            else if (args.Count() == 3)
            {
                clientId = args[0];
                tenantId = args[1];
                clientSecret = args[2];

                Console.WriteLine("------------------------");
                Console.WriteLine($"Application (client) ID: {clientId}");
                Console.WriteLine($"Directory (tenant) ID: {tenantId}");
                Console.WriteLine($"Client Secret: {clientSecret}");
                Console.WriteLine("------------------------");
            }
            else
            {
                Console.WriteLine("Mssing valid input parameters! Type: {Application (client) ID} {Directory (tenant) ID} {Client Secret} ");
            }

            // Set main API path for authentication
            authority = $"https://login.microsoftonline.com/{tenantId}";

            // Create authorization app
            try
            {
                app = ConfidentialClientApplicationBuilder
                    .Create(clientId)
                    .WithClientSecret(clientSecret)
                    .WithAuthority(new Uri(authority))
                    .Build();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }

            string[] scopes = new string[] { $"{resource}/.default" };
            AuthenticationResult result = null;

            // Authenticate and obtain permissions scope
            try
            {
                result = app.AcquireTokenForClient(scopes).ExecuteAsync().Result;
            }
            catch (MsalUiRequiredException ex)
            {
                // Insufficient permissions.
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }
            catch (MsalServiceException ex) when (ex.Message.Contains("AADSTS70011"))
            {
                // Invalid application scope.
                Console.WriteLine(ex.Message);
                Environment.Exit(1);
            }

            // Print token
            Console.WriteLine($"App-Only Access Token:\n{result.AccessToken}\n");
            
            accesToken = result.AccessToken;
            var tokenCredentials = new TokenCredentials(result.AccessToken, "Bearer");
            
            // Test PowerBI Admin API
            Console.WriteLine("Test Power BI API (List workspaces as service principal via Read-Only Admin Api?) Type Y/N:");

            if ("y" == Console.ReadLine().ToLower())
            {
                Console.WriteLine("------------------------");
                Console.WriteLine("Connecting to Power BI API...");

                try
                {
                    // Create PowerBIClient instance
                    powerBIClient = new PowerBIClient(new Uri(ApiUrl), tokenCredentials);

                    // List workspace names with the Admin only method (GetGroupsAsAdmin)
                    var workspaceNames = powerBIClient.Groups.GetGroupsAsAdmin(100, filter: "type eq 'Workspace'").Value.Select(x =&gt; x.Name);

                    //Print output
                    Console.WriteLine("Workspaces found:");

                    foreach (string workspaceName in workspaceNames)
                    {
                        Console.WriteLine("  =&gt; " + workspaceName);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    Environment.Exit(1);
                }
            }

            Console.WriteLine("Done!");

        }
    }
}</pre>
<h3>References</h3>
<p>For additional references, I will recommend this excellent <a href="https://www.sqlbi.com/articles/creating-a-service-principal-account-for-power-bi-api/" target="_blank" rel="noopener">video</a> from Marco Russo and the official Microsoft <a href="https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app" target="_blank" rel="noopener">guide</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/power-bi-api-connector-sample-application/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Create a new Power BI administrator</title>
		<link>https://sqlpowered.com/create-a-new-power-bi-administrator/</link>
					<comments>https://sqlpowered.com/create-a-new-power-bi-administrator/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Tue, 23 Mar 2021 23:39:48 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Tutorials]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=4987</guid>

					<description><![CDATA[In this step-by-step tutorial, we will create a new user in Azure Active Directory, sign him for the first time in the Power BI cloud service and promote him to be the Power BI administrator. This will allow the user to perform full administration of the organizational Power BI tenant....]]></description>
										<content:encoded><![CDATA[<p>In this step-by-step tutorial, we will create a new user in Azure Active Directory, sign him for the first time in the Power BI cloud service and promote him to be the Power BI administrator. This will allow the user to perform full administration of the organizational Power BI tenant.</p>
<h3>1. Create a new user in Azure Active Directory</h3>
<p>Log in to the Azure Portal, navigate to the Azure Active Directory item and click on Users.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5012" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1.png" alt="" width="396" height="293" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1.png 810w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-300x222.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-135x100.png 135w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-768x568.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-360x266.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-160x118.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-320x237.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-331x245.png 331w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-460x340.png 460w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-609x450.png 609w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-676x500.png 676w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_1-520x385.png 520w" sizes="auto, (max-width: 396px) 100vw, 396px" /></p>
<p>Press the + New user button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4997" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3.png" alt="" width="295" height="119" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3.png 652w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-300x121.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-150x61.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-360x145.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-160x65.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-320x129.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_3-520x210.png 520w" sizes="auto, (max-width: 295px) 100vw, 295px" /></p>
<p>Create a new user. For this tutorial, we will call him Power BI Admin and powerbiadmin@sqlpowered.com account name (email address) will be used.<br />
<strong>Don&#8217;t forget to click the Show Password box and note the password. We will need it in the next step!<br />
</strong>When completed, press the create button. You should see the newly created user in the list of Azure AD users.<strong><br />
</strong></p>
<p><img loading="lazy" decoding="async" class="wp-image-4998 alignnone" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4.png" alt="" width="514" height="616" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4.png 1264w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-250x300.png 250w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-854x1024.png 854w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-83x100.png 83w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-768x921.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-360x432.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-133x160.png 133w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-267x320.png 267w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-204x245.png 204w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-283x340.png 283w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-375x450.png 375w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-417x500.png 417w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_4-520x624.png 520w" sizes="auto, (max-width: 514px) 100vw, 514px" /></p>
<h3>2. Sign in to the Power BI</h3>
<p>Go to the <a href="http://powerbi.microsoft.com">powerbi.microsoft.com</a> and sign it with the credentials created above (user name (email) and password).</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4999" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5.png" alt="" width="967" height="78" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5.png 1772w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-300x24.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-1024x83.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-150x12.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-768x62.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-1536x124.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-360x29.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-160x13.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-320x26.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-520x42.png 520w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-720x58.png 720w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-980x79.png 980w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_5-1320x107.png 1320w" sizes="auto, (max-width: 967px) 100vw, 967px" /></p>
<p><img loading="lazy" decoding="async" class=" wp-image-5000 alignnone" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6.png" alt="" width="383" height="271" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6.png 651w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-300x212.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-142x100.png 142w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-360x254.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-160x113.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-320x226.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-347x245.png 347w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-481x340.png 481w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-637x450.png 637w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_6-520x367.png 520w" sizes="auto, (max-width: 383px) 100vw, 383px" /></p>
<p>Because the password set in Azure AD is only temporal and must be changed the first time the user is log in to any Microsoft service, insert the current password in the Current password box and then insert a different new password which should be used by the user permanently and sign in.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5001" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7.png" alt="" width="206" height="227" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7.png 639w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-273x300.png 273w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-91x100.png 91w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-360x396.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-145x160.png 145w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-291x320.png 291w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-223x245.png 223w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-309x340.png 309w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-409x450.png 409w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-454x500.png 454w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_7-520x572.png 520w" sizes="auto, (max-width: 206px) 100vw, 206px" /></p>
<p>Now the password was changed and you will be notified that an account with the same name already exists and you need to sign in again with the new password set in the previous step. This is just a not very clear request to sign in again with the new password.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5002" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8.png" alt="" width="419" height="179" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8.png 1102w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-300x128.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-1024x438.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-150x64.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-768x328.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-360x154.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-160x68.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-320x137.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-520x222.png 520w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-720x308.png 720w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_8-980x419.png 980w" sizes="auto, (max-width: 419px) 100vw, 419px" /></p>
<p>On the next screen you can opt-out from some Microsoft marketing materials. Set is base on your preferences and press the Start button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5003" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9.png" alt="" width="466" height="337" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9.png 1044w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-300x217.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-1024x741.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-138x100.png 138w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-768x555.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-360x260.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-160x116.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-320x231.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-339x245.png 339w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-470x340.png 470w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-622x450.png 622w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-691x500.png 691w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_9-520x376.png 520w" sizes="auto, (max-width: 466px) 100vw, 466px" /></p>
<p>There is an option to invite other people to the Power BI Service. Just Skip it for now.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5004" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10.png" alt="" width="366" height="303" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10.png 999w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-300x248.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-121x100.png 121w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-768x635.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-110x90.png 110w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-360x298.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-160x132.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-320x265.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-296x245.png 296w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-411x340.png 411w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-544x450.png 544w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-605x500.png 605w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_10-520x430.png 520w" sizes="auto, (max-width: 366px) 100vw, 366px" /></p>
<p>You should be successfully logged in to the Power BI Service Portal now.</p>
<h3>3. Review the Admin portal setting</h3>
<p>Press the circle in the top right corner and navigate to the Admin portal section. You can ignore the Power BI Pro offer for now. It doesn&#8217;t have any impact on the Power BI Administrator setup process.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5005" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11.png" alt="" width="353" height="235" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11.png 753w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-300x200.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-150x100.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-360x240.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-160x107.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-320x213.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-368x245.png 368w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-510x340.png 510w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-675x450.png 675w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-750x500.png 750w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_11-520x347.png 520w" sizes="auto, (max-width: 353px) 100vw, 353px" /></p>
<p>What you will see is just this limited list. There is zero option to change anything on the tenant level.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5006" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12.png" alt="" width="538" height="395" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12.png 1420w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-300x220.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-1024x752.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-136x100.png 136w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-768x564.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-360x264.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-160x118.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-320x235.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-334x245.png 334w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-463x340.png 463w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-613x450.png 613w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-681x500.png 681w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_12-520x382.png 520w" sizes="auto, (max-width: 538px) 100vw, 538px" /></p>
<p>To allow more settings available here we must leave the Power BI Service portal and move again to Azure Portal to configure administrator access.</p>
<h3>4. Assign user to the Power BI administrator role</h3>
<p>Go back to the Azure Portal, navigate to the Azure Active Directory, and list of users please select the one created above.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5007" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13.png" alt="" width="636" height="228" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13.png 1679w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-300x108.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-1024x367.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-150x54.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-768x275.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-1536x551.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-360x129.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-160x57.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-320x115.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-520x186.png 520w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-720x258.png 720w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-980x351.png 980w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_13-1320x473.png 1320w" sizes="auto, (max-width: 636px) 100vw, 636px" /></p>
<p>In the user&#8217;s detail click on Assigned roles, then + Add assignments and the filter for the Power BI administrator role. Select it and press the Add button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5008" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14.png" alt="" width="817" height="346" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14.png 1910w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-300x127.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-1024x434.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-150x64.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-768x325.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-1536x651.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-360x152.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-160x68.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-320x136.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-520x220.png 520w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-720x305.png 720w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-980x415.png 980w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_14-1180x500.png 1180w" sizes="auto, (max-width: 817px) 100vw, 817px" /></p>
<p>Our user is now assigned to the Power BI administrator role.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5009" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15.png" alt="" width="778" height="255" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15.png 1682w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-300x98.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-1024x335.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-150x49.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-768x252.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-1536x503.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-360x118.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-320x105.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-520x170.png 520w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-720x236.png 720w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-980x321.png 980w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_15-1320x432.png 1320w" sizes="auto, (max-width: 778px) 100vw, 778px" /></p>
<h3>5. Review the Admin portal section in the Power BI Portal</h3>
<p>When you will go back to the Power BI Portal and refresh the page you may see the full list of available administrative options and configure a lot of setting for the organizational Power BI tenant.<br />
Note: If the simple page refresh doesn&#8217;t work you must sign out and sign in again. This will refresh your permissions list.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5010" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16.png" alt="" width="585" height="433" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16.png 1526w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-300x222.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-1024x757.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-135x100.png 135w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-768x568.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-360x266.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-160x118.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-320x237.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-331x245.png 331w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-460x340.png 460w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-609x450.png 609w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-676x500.png 676w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_16-520x384.png 520w" sizes="auto, (max-width: 585px) 100vw, 585px" /></p>
<h3>Alternative path: Office 365</h3>
<p>Users can be assigned to the Power B administrator role also in Office 365 admin center. Sign in to the <a href="http://admin.microsoft.com">Office 365 Admin Portal</a>, navigate to Users =&gt; Active user and select the user you will promote to Power Bi administrator. In the Roles section click the Manage roles link and then select the Power BI administrator role from the list and assign it to the user.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-5019" src="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19.png" alt="" width="714" height="417" srcset="https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19.png 1854w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-300x175.png 300w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-1024x598.png 1024w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-768x448.png 768w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-1536x896.png 1536w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-360x210.png 360w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-160x93.png 160w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-320x187.png 320w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-420x245.png 420w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-583x340.png 583w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-771x450.png 771w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-857x500.png 857w, https://sqlpowered.com/wp-content/uploads/2021/03/Setup_Power_BI_Administrator_19-520x303.png 520w" sizes="auto, (max-width: 714px) 100vw, 714px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/create-a-new-power-bi-administrator/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Saving Microsoft Forms responses to Azure SQL with Power Automate</title>
		<link>https://sqlpowered.com/saving-microsoft-forms-responses-to-azure-sql-with-power-automate/</link>
					<comments>https://sqlpowered.com/saving-microsoft-forms-responses-to-azure-sql-with-power-automate/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Mon, 19 Oct 2020 06:51:52 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=4700</guid>

					<description><![CDATA[One of our customers was facing the issue of how to save responses from Microsoft Forms to Azure SQL database. The initial idea was to go with Google Forms and Zappier but we have recommended the use of Microsoft Forms to stay inside the Azure environment instead of being split...]]></description>
										<content:encoded><![CDATA[<p>One of our customers was facing the issue of how to save responses from Microsoft Forms to Azure SQL database. The initial idea was to go with Google Forms and Zappier but we have recommended the use of Microsoft Forms to stay inside the Azure environment instead of being split across various service providers. The main part of the solution was realized with Power Automate Template available in the Templates library. I will show you click thru demonstration on how to make simple form and save responses directly to Azure SQL Database.</p>
<p>Let&#8217;s go to <a href="https://forms.office.com" target="_blank" rel="noopener noreferrer">Microsoft Forms</a> and build such a simple form as in the picture:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4702" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1.png" alt="" width="395" height="421" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1.png 1490w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-282x300.png 282w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-962x1024.png 962w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-94x100.png 94w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-768x817.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-1443x1536.png 1443w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-360x383.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-150x160.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-301x320.png 301w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-230x245.png 230w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-319x340.png 319w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-423x450.png 423w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-470x500.png 470w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_1-520x554.png 520w" sizes="auto, (max-width: 395px) 100vw, 395px" /></p>
<p>Go to <a href="https://flow.microsoft.com" target="_blank" rel="noopener noreferrer">Power Automate</a> and search for &#8220;Store Microsoft Forms responses in a SQL Server Table&#8221; template:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4709" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2.png" alt="" width="402" height="169" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2.png 2105w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-300x126.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-1024x431.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-150x63.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-768x323.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-1536x647.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-2048x862.png 2048w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-360x152.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-160x67.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-320x135.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-520x219.png 520w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-720x303.png 720w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-980x412.png 980w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_2-1188x500.png 1188w" sizes="auto, (max-width: 402px) 100vw, 402px" /></p>
<p>Click on the template icon and on the next screen there is a simple description of the task. Below are two + buttons to set connections to your Microsoft Form you will receive responses from and to SQL Server database and table where received responses should be persisted.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4717" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1.png" alt="" width="445" height="426" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1.png 1343w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-300x287.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-1024x980.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-105x100.png 105w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-768x735.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-360x344.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-160x153.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-320x306.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-256x245.png 256w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-355x340.png 355w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-470x450.png 470w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-523x500.png 523w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_3-1-520x498.png 520w" sizes="auto, (max-width: 445px) 100vw, 445px" /></p>
<p>Setup the Microsoft Forms connection first. It&#8217;s easy: just click the + button and it will connect you to the Microsoft forms store which belongs to your account you have signed in. The connection will be marked with a green OK symbol.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4704" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4.png" alt="" width="397" height="29" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4.png 1041w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-300x22.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-1024x75.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-150x11.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-768x56.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-360x26.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-160x12.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-320x23.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-520x38.png 520w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-720x53.png 720w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_4-980x72.png 980w" sizes="auto, (max-width: 397px) 100vw, 397px" /></p>
<p>Then press the + for the SQL Server connection and fill in the form. In case it&#8217;s Azure SQL Database the connection will fail for the first time saying that the client with the displayed IP address can not connect to the database. This means that the connection was blocked by the Azure SQL Server firewall and you should take the address and create a new firewall rule for it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4710" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5.png" alt="" width="429" height="339" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5.png 1050w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-300x237.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-1024x808.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-127x100.png 127w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-768x606.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-360x284.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-160x126.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-320x253.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-310x245.png 310w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-431x340.png 431w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-570x450.png 570w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-633x500.png 633w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_5-520x411.png 520w" sizes="auto, (max-width: 429px) 100vw, 429px" /></p>
<p>Once both connections are set properly you can continue in the wizard.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4705" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6.png" alt="" width="413" height="77" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6.png 1051w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-300x56.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-1024x191.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-150x28.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-768x143.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-360x67.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-160x30.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-320x60.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-520x97.png 520w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-720x134.png 720w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_6-980x183.png 980w" sizes="auto, (max-width: 413px) 100vw, 413px" /></p>
<p>Prepare the table where form responses will be stored. First there columns in the table are special columns for the ID of the responses, who submitted the response, and when. The remaining columns are matching to form questions one by one. Copy the CREATE table code and run it in the target database you have connected above.</p>
<pre class="lang:tsql decode:true ">CREATE TABLE [dbo].[SampleFormAnswers](
	[ResponseId] [INT] NOT NULL,
	[SubmittedBy] [NVARCHAR](200) NULL,
	[SubmittedDtm] [NVARCHAR](50) NULL,
	[Question1_Choice] [NVARCHAR](500) NULL,
	[Question2_Text] [NVARCHAR](500) NULL,
	[Question3_Rating] [NVARCHAR](500) NULL
)
GO</pre>
<p>Go back to Power Automate and continue the wizard. It&#8217;s quite intuitive. Select your sample form in the first section. &#8220;<em>Get response details</em>&#8221; section keep as it was prefilled automatically. The interesting part is coming in the &#8220;Insert row (V2)&#8221; task where you will configure the mapping between form response values and database table columns. Select the Server, database, and the table you have created in the previous step. Power Automate will automatically list all table columns and display them in the form.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4711" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7.png" alt="" width="388" height="508" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7.png 1050w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-229x300.png 229w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-783x1024.png 783w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-76x100.png 76w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-768x1005.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-360x471.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-122x160.png 122w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-245x320.png 245w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-187x245.png 187w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-260x340.png 260w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-344x450.png 344w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-382x500.png 382w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_7-520x680.png 520w" sizes="auto, (max-width: 388px) 100vw, 388px" /></p>
<p>Connect all columns to response properties as in the picture. If you will click inside the column box search box will appear on the right side of it and you can search for the proper form fields in it:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4706" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8.png" alt="" width="253" height="346" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8.png 679w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-219x300.png 219w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-73x100.png 73w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-360x493.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-117x160.png 117w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-234x320.png 234w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-179x245.png 179w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-249x340.png 249w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-329x450.png 329w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-365x500.png 365w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_8-520x711.png 520w" sizes="auto, (max-width: 253px) 100vw, 253px" /></p>
<p>Once completed, press the Save button in the wizzard and that&#8217;s it.</p>
<p>It&#8217;s time to test if it works. Navigate back to your form and press the <em>Preview</em> button in the top panel. This will allow you to fill in the form. Fill it as in the picture to have some interesting variants of data in the table later:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4707" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9.png" alt="" width="393" height="404" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9.png 1337w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-292x300.png 292w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-996x1024.png 996w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-97x100.png 97w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-768x790.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-360x370.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-156x160.png 156w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-311x320.png 311w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-238x245.png 238w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-331x340.png 331w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-438x450.png 438w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-486x500.png 486w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_9-520x535.png 520w" sizes="auto, (max-width: 393px) 100vw, 393px" /></p>
<p>Submit the form and you should see the approval message:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4712" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10.png" alt="" width="200" height="213" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10.png 493w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-282x300.png 282w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-94x100.png 94w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-360x383.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-150x160.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-300x320.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-230x245.png 230w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-319x340.png 319w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-423x450.png 423w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_10-470x500.png 470w" sizes="auto, (max-width: 200px) 100vw, 200px" /></p>
<p>Execute SQL query against your database to see if the form response arrived there:</p>
<pre class="lang:tsql decode:true">SELECT * FROM [dbo].[SampleFormAnswers]
GO</pre>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4714" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1.png" alt="" width="747" height="35" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1.png 1429w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-300x14.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-1024x48.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-150x7.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-768x36.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-360x17.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-160x8.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-320x15.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-520x24.png 520w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-720x34.png 720w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-980x46.png 980w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_13-1-1320x62.png 1320w" sizes="auto, (max-width: 747px) 100vw, 747px" /></p>
<p>In case you have properly configured everything the response looks like as in the picture (with a different ID maybe). You can see more execution details if you will click on the flow in the Power Automate administration:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4713" src="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11.png" alt="" width="549" height="243" srcset="https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11.png 2266w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-300x133.png 300w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-1024x453.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-150x66.png 150w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-768x340.png 768w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-1536x680.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-2048x907.png 2048w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-360x159.png 360w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-160x71.png 160w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-320x142.png 320w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-520x230.png 520w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-720x319.png 720w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-980x434.png 980w, https://sqlpowered.com/wp-content/uploads/2020/10/Save_Google_Forms_Responses_To_Azure_SQL_Table_11-1130x500.png 1130w" sizes="auto, (max-width: 549px) 100vw, 549px" /></p>
<p>In case of the failure you will see the failed execution in the &#8220;<em>28-day run history</em>&#8221; section and you can observe error details. Errors are enough descriptive to fix them quickly. What is really amazing is the <em>Duration</em>: form response arrived in the database nearly realtime.</p>
<p>Few points to consider:</p>
<ul>
<li>See the <a href="https://flow.microsoft.com/en-us/pricing/" target="_blank" rel="noopener noreferrer">Power Automate pricing</a>. It&#8217;s comparable to Zappier or other services but with the advantage that there is no such 15 minutes synchronization limit.</li>
<li>You can use <a href="https://sqlpowered.com/string_agg/">STRING_AGG()</a> function for multivalue answers parsing.</li>
<li>It&#8217;s a question if the Power Automate IP address you need to grant access in the Aure SQL Server firewall won&#8217;t change in time? I&#8217;m not sure about that.</li>
<li>SubmittedDtm column is easier to have a string. When it&#8217;s DATETIME the flow will fail with a casting error.</li>
<li>When you will do some changes in the table it may be required to drop the last task in the flow (insert row) and add it again to refresh the columns list.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/saving-microsoft-forms-responses-to-azure-sql-with-power-automate/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Switch IP addresses between two Azure VMs</title>
		<link>https://sqlpowered.com/switch-ip-addresses-between-two-azure-vms/</link>
					<comments>https://sqlpowered.com/switch-ip-addresses-between-two-azure-vms/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Thu, 09 Jul 2020 16:29:40 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=4422</guid>

					<description><![CDATA[Changing an IP address of Azure virtual machines isn&#8217;t a complicated task. Simply locate the VM in Azure Portal and change the IP of it. A little bit more complicated is the scenario when we would like to switch IP addresses between two existing virtual machines. This scenario may be...]]></description>
										<content:encoded><![CDATA[<p>Changing an IP address of Azure virtual machines isn&#8217;t a complicated task. Simply locate the VM in Azure Portal and change the IP of it. A little bit more complicated is the scenario when we would like to switch IP addresses between two existing virtual machines. This scenario may be suitable many times like VM maintenance, licenses management, restore from VM image, etc.</p>
<p>One option we have is to use <a href="https://docs.microsoft.com/en-us/cli/azure/network/nic/ip-config?view=azure-cli-latest">nic-ipconfig</a> CLI. But I will show you another option which works without scripting. We will exchange NIC (Network Interfaces) between VMs and this will also switch IP addresses associated with them.</p>
<p>We will play with two virtual machines: <strong>int-worker</strong> and <strong>int-worker2</strong>. Our goal is to take the current IP address of the <strong>int-worker</strong> VM and assign it to <strong>int-worker2</strong> and the opposite.</p>
<p>1. Check our VMs status first</p>
<p>Both VMs are running now.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4435" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1.png" alt="" width="344" height="42" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1.png 894w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-300x37.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-150x18.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-768x94.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-360x44.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-160x20.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-320x39.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-520x63.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_1-1-720x88.png 720w" sizes="auto, (max-width: 344px) 100vw, 344px" /></p>
<p>Go to Networking and check settings for both VMs.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4424" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2.png" alt="" width="550" height="170" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2.png 2045w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-300x93.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-1024x317.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-150x46.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-768x238.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-1536x475.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-360x111.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-160x50.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-320x99.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-520x161.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-720x223.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-980x303.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_2-1320x409.png 1320w" sizes="auto, (max-width: 550px) 100vw, 550px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4425" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3.png" alt="" width="555" height="171" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3.png 2066w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-300x92.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-1024x316.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-150x46.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-768x237.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-1536x474.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-2048x631.png 2048w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-360x111.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-160x49.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-320x99.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-520x160.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-720x222.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-980x302.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_3-1320x407.png 1320w" sizes="auto, (max-width: 555px) 100vw, 555px" /></p>
<p>We can see that:</p>
<p>&#8211; <strong>int-worker</strong> VM is attached to NIC <em>dev-worker399</em> with IP address starting 52.166.<br />
&#8211; <strong>int-worker2</strong> VM is attached to NIC <em>dev-worker2167</em> with IP address starting 40.91.</p>
<p>2. We must stop both VMs before we can detach/attach NIC from it. VMs must have status Stopped (deallocated).</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4426" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4.png" alt="" width="370" height="231" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4.png 1011w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-300x188.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-150x94.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-768x480.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-360x225.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-160x100.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-320x200.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-392x245.png 392w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-544x340.png 544w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-720x450.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-800x500.png 800w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_4-520x325.png 520w" sizes="auto, (max-width: 370px) 100vw, 370px" /></p>
<p>3. Because we can&#8217;t have VM without at least one NIC attached to it we must create another new NIC as spare. Search for &#8220;Network interface&#8221; in Azure Portal and add a new one. It must be in the same resource group and virtual network as our VMs.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4427" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5.png" alt="" width="443" height="382" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5.png 1415w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-300x259.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-1024x883.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-116x100.png 116w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-768x662.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-360x310.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-160x138.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-320x276.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-284x245.png 284w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-394x340.png 394w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-522x450.png 522w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-580x500.png 580w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_5-520x448.png 520w" sizes="auto, (max-width: 443px) 100vw, 443px" /></p>
<p>We have to call this NIC &#8220;dummy-nic&#8221; that we can search for it easily and is clear to everyone it was created just for maintenance purposes.</p>
<p>4. Go to the Networking configuration section of the <strong>int-worker</strong> VM and attach the newly created <em>dummy-nic</em> to it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4428" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6.png" alt="" width="605" height="241" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6.png 1288w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-300x119.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-1024x408.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-150x60.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-768x306.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-360x143.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-160x64.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-320x127.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-520x207.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-720x287.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-980x390.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_6-1255x500.png 1255w" sizes="auto, (max-width: 605px) 100vw, 605px" /></p>
<p>5. Because the VM has 2 NICs assigned now, one of them can be detached. Detach NIC <em>dev-worker399</em>.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4429" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7.png" alt="" width="549" height="190" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7.png 1287w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-300x104.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-1024x355.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-150x52.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-768x266.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-360x125.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-160x55.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-320x111.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-520x180.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-720x250.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_7-980x340.png 980w" sizes="auto, (max-width: 549px) 100vw, 549px" /></p>
<p>6. Go to the same setting screen of <strong>int-worker2</strong> VM and attach the <em>dev-worker399</em> NIC to it. It should appear in the selector because the NIC is currently not assigned to any VM and can be used for attaching it to a new one.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4430" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8.png" alt="" width="590" height="240" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8.png 1289w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-300x122.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-1024x416.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-150x61.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-768x312.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-360x146.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-160x65.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-320x130.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-520x211.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-720x293.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-980x398.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_8-1230x500.png 1230w" sizes="auto, (max-width: 590px) 100vw, 590px" /></p>
<p>7. Next, you detach the original NIC from <strong>int-worker2</strong> VM and continue the same path to assign it to <strong>int-worker</strong> VM and detach <em>dummy-nic</em> from it.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4431" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9.png" alt="" width="521" height="180" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9.png 1289w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-300x104.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-1024x354.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-150x52.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-768x265.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-360x124.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-160x55.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-320x110.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-520x180.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-720x249.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_9-980x338.png 980w" sizes="auto, (max-width: 521px) 100vw, 521px" /></p>
<p>8. Check the new IP address of VMs. As you can see <strong>int-worker2</strong> VM has the IP address assigned which was originally assigned to int-worker VM.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4432" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10.png" alt="" width="569" height="123" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10.png 2053w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-300x65.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-1024x221.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-150x32.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-768x166.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-1536x331.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-2048x442.png 2048w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-360x78.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-160x35.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-320x69.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-520x112.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-720x155.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-980x211.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_10-1320x285.png 1320w" sizes="auto, (max-width: 569px) 100vw, 569px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-4433" src="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11.png" alt="" width="559" height="186" srcset="https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11.png 1720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-300x100.png 300w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-1024x341.png 1024w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-150x50.png 150w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-768x255.png 768w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-1536x511.png 1536w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-360x120.png 360w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-160x53.png 160w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-320x106.png 320w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-520x173.png 520w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-720x239.png 720w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-980x326.png 980w, https://sqlpowered.com/wp-content/uploads/2020/07/Switching-ip-address-between-two-virtual-machines-azure_11-1320x439.png 1320w" sizes="auto, (max-width: 559px) 100vw, 559px" /></p>
<p>That&#8217;s it we are done. If you would like to know more about NICs, you can follow this <a href="https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-network-interface">article</a>. You can also use <a href="https://docs.microsoft.com/en-us/cli/azure/vm/nic?view=azure-cli-latest">CLI</a> to script that for automation.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/switch-ip-addresses-between-two-azure-vms/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dynamic Data Masking in Azure SQL</title>
		<link>https://sqlpowered.com/dynamic-data-masking-in-azure-sql/</link>
					<comments>https://sqlpowered.com/dynamic-data-masking-in-azure-sql/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Thu, 31 Oct 2019 22:49:03 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=3400</guid>

					<description><![CDATA[Dynamic Data Masking is available for Azure SQL Database as one of the main security features. There is more on Data Masking on Microsoft Docs. I don&#8217;t want to repeat all these technical details, but rather provide you with a simple tutorial on how to set up Dynamic Data Masking...]]></description>
										<content:encoded><![CDATA[<p>Dynamic Data Masking is available for Azure SQL Database as one of the main security features. There is more on Data Masking on <a href="https://docs.microsoft.com/en-us/sql/relational-databases/security/dynamic-data-masking?view=sql-server-ver15" target="_blank" rel="noopener noreferrer">Microsoft Docs</a>. I don&#8217;t want to repeat all these technical details, but rather provide you with a simple tutorial on how to set up Dynamic Data Masking for Azure SQL Database. Free <a href="https://azure.microsoft.com/en-us/free/" target="_blank" rel="noopener noreferrer">Azure subscription</a> is the only thing you will need to try. Please create one Azure SQL Database for testing or use an existing one.</p>
<h3>Creating a masking rule</h3>
<p>1. Navigate to your database in Azure Portal and choose the Dynamic Data Masking item from the Security menu:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3402" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01.png" alt="" width="626" height="299" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01.png 1299w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-150x72.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-300x143.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-768x367.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-1024x490.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-160x76.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-320x153.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-512x245.png 512w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-711x340.png 711w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-941x450.png 941w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-1046x500.png 1046w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_01-520x249.png 520w" sizes="auto, (max-width: 626px) 100vw, 626px" /></p>
<p>2. Click <em>Add mask</em> button to create a new masking rule. I&#8217;m using AdwentureWorkLT as a sample database for this tutorial. There is table <em>SalesLT.Customer</em> table with column <em>EmailAddress</em> which I would like to mask to hide email addresses from low privileged users.</p>
<p>There are few predefined masking functions and one of them is created exactly for simple masking of email addresses. Please choose it in the field <em><strong>Masking field format:</strong></em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3403" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02.png" alt="" width="272" height="410" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02.png 439w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-66x100.png 66w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-199x300.png 199w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-106x160.png 106w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-212x320.png 212w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-162x245.png 162w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-225x340.png 225w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-298x450.png 298w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_02-332x500.png 332w" sizes="auto, (max-width: 272px) 100vw, 272px" /></p>
<p>3. Save the rule and you will see it listed in the Masking rules overview:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3404" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03.png" alt="" width="478" height="269" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03.png 907w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-150x85.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-300x169.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-768x433.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-160x90.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-320x180.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-435x245.png 435w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-603x340.png 603w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-799x450.png 799w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-887x500.png 887w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_03-520x293.png 520w" sizes="auto, (max-width: 478px) 100vw, 478px" /></p>
<p>We have successfully created a masking rule to hide email addresses and we will test it now.</p>
<h3>Testing masking rule</h3>
<p>Connect to Azure SQL Database for which we have created masking rule and run following script from SSMS, Azure Data Studio, or Query Editor in Azure Portal:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="sql">-- run as admin user
SELECT CustomerID, EmailAddress FROM SalesLT.Customer
GO

-- create user with low permissions
CREATE USER LowPermUser WITHOUT LOGIN
GO

-- grant SELECT to LowPermUser
GRANT SELECT ON SalesLT.Customer TO LowPermUser
GO

-- execute as LowPermUser
EXECUTE AS USER = 'LowPermUser'

SELECT CustomerID, EmailAddress FROM SalesLT.Customer
GO</pre>
<p>Result set 1:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3405" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04.png" alt="" width="254" height="181" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04.png 356w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04-140x100.png 140w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04-300x214.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04-160x114.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04-320x228.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_04-343x245.png 343w" sizes="auto, (max-width: 254px) 100vw, 254px" /></p>
<p>Result set 2:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3406" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_05.png" alt="" width="247" height="162" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_05.png 318w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_05-150x98.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_05-300x196.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_05-160x105.png 160w" sizes="auto, (max-width: 247px) 100vw, 247px" /></p>
<p>The query will return two result sets you can see above. How that works?</p>
<p>1. The first result set is coming from a simple select to source table which we have executed against the database under the admin account which has by default all data unmasked.</p>
<p>2. We have created low privileged database user <em>LowPermUser </em>and granted only SELECT permission on our sample table.</p>
<p>3. We switched execution context to the <em>LowPermUser</em> and executed again SELECT query which returned Result set 2 containing email addresses masked with the predefined Email masking function.</p>
<p>That&#8217;s it. Easy.</p>
<p>if you would like to review existing masking rules configured for the database then it can be done with this simple query:</p>
<pre class="EnlighterJSRAW" data-enlighter-language="sql">SELECT 
	s.name SchemaName, t.name TableName, c.name ColumnName, 
	c.is_masked, c.masking_function
FROM sys.masked_columns c
	INNER JOIN sys.tables t ON t.object_id = c.object_id 
	INNER JOIN sys.schemas s ON s.schema_id = t.schema_id
GO</pre>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3407" src="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06.png" alt="" width="488" height="35" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06.png 655w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06-150x11.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06-300x22.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06-160x11.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06-320x23.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Dynamic_Data_Masking_Tutorial_06-520x37.png 520w" sizes="auto, (max-width: 488px) 100vw, 488px" /></p>
<p>As a next step, I will recommend reviewing some <a href="https://sqlsunday.com/2018/02/05/an-alternative-to-data-masking/" target="_blank" rel="noopener noreferrer">security concerns</a> related to Dynamic Data Masking.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/dynamic-data-masking-in-azure-sql/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Configure Azure SQL Transparent Data Encryption With Your Own Key</title>
		<link>https://sqlpowered.com/configure-azure-sql-transparent-data-encryption-with-your-own-key/</link>
					<comments>https://sqlpowered.com/configure-azure-sql-transparent-data-encryption-with-your-own-key/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Mon, 28 Oct 2019 20:52:07 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=3409</guid>

					<description><![CDATA[Transparent Data Encryption is by default configured for Azure SQL Database to use service managed key. This means that Azure is managing encryption keys for you with 90 days rotation. If you have some regulatory or data privacy requirement you can change the default setting and encrypt Azure SQL Database...]]></description>
										<content:encoded><![CDATA[<p>Transparent Data Encryption is by default configured for Azure SQL Database to use service managed key. This means that Azure is managing encryption keys for you with 90 days rotation. If you have some regulatory or data privacy requirement you can change the default setting and encrypt Azure SQL Database with your own key. I will show you how to set it all using the Azure Key Vault step-by-step in this tutorial.</p>
<p>The only one prerequisite you will need is configured Azure SQL Server. There is no need to have any database created because TDE is configured at server level and at database level you can only switch it on or off.</p>
<p>To use our own encryption keys we need to have Azure Key Vault preconfigured. If you haven&#8217;t done it till now, follow a few simple steps listed below.</p>
<h3>Configure Azure Key Vault</h3>
<p>Open Azure Portal and search for Key Vault item in available services. Click on the Create button and complete the form using your own Resource group name:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3411" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1.png" alt="" width="657" height="450" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1.png 1114w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-146x100.png 146w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-300x205.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-768x525.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-1024x700.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-160x109.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-320x219.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-358x245.png 358w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-497x340.png 497w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-658x450.png 658w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-731x500.png 731w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_1-520x356.png 520w" sizes="auto, (max-width: 657px) 100vw, 657px" /></p>
<p>Press the Review + Create button and wait a few seconds before the deployment is completed.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3412" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2.png" alt="" width="547" height="192" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2.png 968w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-150x53.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-300x105.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-768x270.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-160x56.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-320x112.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-520x183.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_2-720x253.png 720w" sizes="auto, (max-width: 547px) 100vw, 547px" /></p>
<h3>Create encryption key</h3>
<p>When the Key vault was successfully created we can create a new key that will be later used by for encryption by TDE service. Select for Keys item in the Settings section and Genera new one:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3413" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3.png" alt="" width="590" height="322" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3.png 968w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-150x82.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-300x164.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-768x419.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-160x87.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-320x175.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-449x245.png 449w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-623x340.png 623w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-825x450.png 825w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-917x500.png 917w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_3-520x284.png 520w" sizes="auto, (max-width: 590px) 100vw, 590px" /></p>
<p>Name of the key is up to you. For other items, we will use default settings.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3414" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4.png" alt="" width="321" height="439" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4.png 541w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-73x100.png 73w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-220x300.png 220w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-117x160.png 117w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-234x320.png 234w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-179x245.png 179w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-249x340.png 249w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-329x450.png 329w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-366x500.png 366w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_4-520x710.png 520w" sizes="auto, (max-width: 321px) 100vw, 321px" /></p>
<p>Press the Create button and verify that the creation of the key was completed:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3415" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5.png" alt="" width="635" height="330" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5.png 1017w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-150x78.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-300x156.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-768x399.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-160x83.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-320x166.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-472x245.png 472w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-655x340.png 655w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-867x450.png 867w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-963x500.png 963w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_5-520x270.png 520w" sizes="auto, (max-width: 635px) 100vw, 635px" /></p>
<h3>Configure Transparent data encryption</h3>
<p>Navigate to your SQL Server instance and in the Security group and click on Transparent data encryption item. As you can see using service-managed keys is the default option.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3416" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06.png" alt="" width="742" height="310" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06.png 1319w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-150x63.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-300x125.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-768x321.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-1024x428.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-160x67.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-320x134.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-520x217.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-720x301.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-980x409.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_06-1197x500.png 1197w" sizes="auto, (max-width: 742px) 100vw, 742px" /></p>
<p>Because we will use for the encryption our own keys, change the setting to Yes and when prompted pickup you Azure Key Vault and select proper encryption Key:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3417" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7.png" alt="" width="718" height="438" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7.png 1312w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-150x91.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-300x183.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-768x468.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-1024x624.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-160x98.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-320x195.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-402x245.png 402w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-558x340.png 558w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-738x450.png 738w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-820x500.png 820w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_7-520x317.png 520w" sizes="auto, (max-width: 718px) 100vw, 718px" /></p>
<p>Finally, press the Save button.</p>
<p>If saving your new configuration has failed with following error, continue with next step:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3418" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8.png" alt="" width="319" height="149" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8.png 518w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8-150x70.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8-300x140.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8-160x75.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_8-320x149.png 320w" sizes="auto, (max-width: 319px) 100vw, 319px" /></p>
<p>Using Azure Key Vault together with TDE requires the Key Vault to be properly configured. <a href="https://docs.microsoft.com/cs-cz/azure/key-vault/key-vault-ovw-soft-delete"><em>Soft delete</em></a> functionality needs to be enabled to protect you against full data loss in case of accidental deletion of encryption keys. There is no such configuration option in Azure Portal and we will need to open Cloud Shell and configure the required setting using <a href="https://docs.microsoft.com/cs-cz/azure/key-vault/key-vault-soft-delete-powershell">Powershell</a>:</p>
<pre class="lang:ps decode:true">($resource = Get-AzResource -ResourceId (Get-AzKeyVault -VaultName "ContosoVault").ResourceId).Properties | Add-Member -MemberType "NoteProperty" -Name "enableSoftDelete" -Value "true"

Set-AzResource -resourceid $resource.ResourceId -Properties $resource.Properties</pre>
<p>Console output:</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3419" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9.png" alt="" width="1839" height="472" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9.png 1839w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-150x38.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-300x77.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-768x197.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-1024x263.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-160x41.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-320x82.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-520x133.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-720x185.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-980x252.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_9-1320x339.png 1320w" sizes="auto, (max-width: 1839px) 100vw, 1839px" /></p>
<p>You can navigate back to Key Vault detail to check is the configuration succeed:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3420" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10.png" alt="" width="617" height="144" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10.png 1782w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-150x35.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-300x70.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-768x179.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-1024x238.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-160x37.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-320x75.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-520x121.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-720x168.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-980x228.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_10-1320x307.png 1320w" sizes="auto, (max-width: 617px) 100vw, 617px" /></p>
<p>Let&#8217;s go back to TDE configuration screen and try again:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3421" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11.png" alt="" width="553" height="421" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11.png 930w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-131x100.png 131w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-300x229.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-768x585.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-160x122.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-320x244.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-321x245.png 321w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-446x340.png 446w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-590x450.png 590w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-656x500.png 656w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Using_Own_Key_For_Transparent_Data_Encryption_11-520x396.png 520w" sizes="auto, (max-width: 553px) 100vw, 553px" /></p>
<p>The operation completed successfully this time and our TDE is using our own keys stored in Azure Key Vault instead of service-managed keys.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/configure-azure-sql-transparent-data-encryption-with-your-own-key/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Run your first U-SQL script in Azure Data Lake (step-by-step tutorial)</title>
		<link>https://sqlpowered.com/run-your-first-u-sql-script-in-azure-data-lake-step-by-step-tutorial/</link>
					<comments>https://sqlpowered.com/run-your-first-u-sql-script-in-azure-data-lake-step-by-step-tutorial/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Mon, 21 Oct 2019 21:49:31 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[U-SQL]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=3211</guid>

					<description><![CDATA[I don&#8217;t want to write what is Azure Data Lake. Simply click the link to know more. Instead of that, I have prepared for you a short and easy-to-follow step-by-step guide to have your own Data Lake. The only thing you need to have is your own Azure subscription. If...]]></description>
										<content:encoded><![CDATA[<p>I don&#8217;t want to write what is <a href="https://azure.microsoft.com/en-us/solutions/data-lake/" target="_blank" rel="noopener noreferrer">Azure Data Lake</a>. Simply click the link to know more. Instead of that, I have prepared for you a short and easy-to-follow step-by-step guide to have your own Data Lake. The only thing you need to have is your own Azure subscription. If you don&#8217;t have one, click this <a href="https://azure.microsoft.com/en-us/free/" target="_blank" rel="noopener noreferrer">link</a> and create a free subscription with enough starting credit to play with it.</p>
<p>Azure Data Lake consists of two important parts working together:</p>
<ol>
<li><strong>Azure Data Lake Storage</strong> &#8211; massively scalable, secure data lake functionality built on Azure Blob Storage.</li>
<li><strong>Azure Data Lake Analytics</strong> &#8211; main data lake analytics service using Azure Data Lake Storage to read data from and process them</li>
</ol>
<p>Because Azure Data Lake Analytics service depends on Azure Data Lake Storage, we will first create that one and then continue with Data Lake Analytics.</p>
<h3>Creating Azure Data Lake Storage</h3>
<p>1. Open Azure Portal and search for Azure Data Lake Storage. You can select Gen1. Gen2 will be covered in another post.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3255" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01.png" alt="" width="293" height="336" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01.png 454w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-87x100.png 87w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-261x300.png 261w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-139x160.png 139w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-279x320.png 279w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-213x245.png 213w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-296x340.png 296w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-392x450.png 392w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_01-436x500.png 436w" sizes="auto, (max-width: 293px) 100vw, 293px" /></p>
<p>2. Click Add button to initiate the New Data Lake Storage Gen 1 window:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3256" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02.png" alt="" width="509" height="443" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02.png 673w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-115x100.png 115w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-300x261.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-160x139.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-320x279.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-281x245.png 281w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-390x340.png 390w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-517x450.png 517w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-574x500.png 574w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_02-520x453.png 520w" sizes="auto, (max-width: 509px) 100vw, 509px" /></p>
<p>3. Fill all mandatory fields base on your preferred values.</p>
<p>You should setup:</p>
<ul>
<li><em>Name</em> which will form later also URL of your storage. Follow naming rules.</li>
<li>If you have more <em>Subscriptions</em> select the proper one.</li>
<li><em>Resource group</em> means where your Data Lake Storage belongs. If you don&#8217;t have one, create new one.</li>
<li>The <i>Location </i>should be selected geographically closer to your current location.</li>
</ul>
<p>Keep other settings as they are and press the <em>Create</em> button.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3257" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03.png" alt="" width="271" height="526" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03.png 348w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-52x100.png 52w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-155x300.png 155w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-82x160.png 82w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-165x320.png 165w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-126x245.png 126w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-175x340.png 175w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-232x450.png 232w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_03-258x500.png 258w" sizes="auto, (max-width: 271px) 100vw, 271px" /></p>
<p>4. You should see a notification that your request was registered and is being processed. Once it&#8217;s completed then press <em>the Refresh</em> button and you should see your new Data Lake Storage Gen1 object in the list:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3258" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04.png" alt="" width="704" height="229" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04.png 975w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-150x49.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-300x98.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-768x250.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-160x52.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-320x104.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-520x169.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_04-720x234.png 720w" sizes="auto, (max-width: 704px) 100vw, 704px" /></p>
<p>With this step, we have completed the preparation of the storage account and we can continue with the creation of the Data Lake Analytics service.</p>
<h3>Configure Azure Data Lake Analytics</h3>
<ol>
<li>Go back to Portal and search for Data Lake Analytics.</li>
</ol>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3259" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05.png" alt="" width="333" height="303" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05.png 453w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-110x100.png 110w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-300x273.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-160x146.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-320x291.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-269x245.png 269w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_05-374x340.png 374w" sizes="auto, (max-width: 333px) 100vw, 333px" /></p>
<p>2. Press the Add button to create a new Data Lake Analytics instance.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3260" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06.png" alt="" width="598" height="182" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06.png 917w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-150x46.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-300x91.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-768x234.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-160x49.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-320x97.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-520x158.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_06-720x219.png 720w" sizes="auto, (max-width: 598px) 100vw, 598px" /></p>
<p>3. Fill in all required fields.</p>
<p>You can do it the same way as you did for storage configuration.</p>
<p>Important is to select your previously created Data Lake Storage account to be used with this instance of Data Lake Analytics.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3261" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07.png" alt="" width="430" height="454" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07.png 666w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-95x100.png 95w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-284x300.png 284w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-151x160.png 151w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-303x320.png 303w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-232x245.png 232w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-322x340.png 322w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-426x450.png 426w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-473x500.png 473w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_07-520x550.png 520w" sizes="auto, (max-width: 430px) 100vw, 430px" /></p>
<p>After the form is completed and validated press the Create button. You should see a notification about processing your request.</p>
<p>4. Once processing is completed press the <em>Refresh</em> button and you should see your new instance of Data Lake Analytics services listed below.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3262" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08.png" alt="" width="638" height="186" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08.png 1059w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-150x44.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-300x87.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-768x223.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-1024x298.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-160x47.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-320x93.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-520x151.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-720x209.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_08-980x285.png 980w" sizes="auto, (max-width: 638px) 100vw, 638px" /></p>
<p>With all these steps we have successfully completed the first part of our tutorial: Azure Data Lake Storage account and Azure Data Lake Analytics service were created and are ready to be used.</p>
<h2>Using Azure Data Lake</h2>
<p>In the second part of this tutorial, we will test the basic scenario of how to use configured services to process data sample data.</p>
<p>First of all open this <a href="http://eforexcel.com/wp/wp-content/uploads/2017/07/500000-Sales-Records.zip" target="_blank" rel="noopener noreferrer">link</a> to download a sample CSV file of 500000 sales records.zip from cool page <a href="http://eforexcel.com/wp" target="_blank" rel="noopener noreferrer">http://eforexcel.com/wp</a></p>
<p>Unzip the file locally and continue with the following steps:</p>
<h3>Upload sample data to Azure Data Lake Storage</h3>
<p>1. Navigate to the All resources icon in the left panel in Portal and from the list click on the Data Lake Storage Gen 1 resource we have created before. After it will open there is <em>a Data explorer </em>button you should click on<em>.</em></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3263" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09.png" alt="" width="669" height="337" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09.png 1618w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-150x76.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-300x151.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-768x387.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-1024x516.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-160x81.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-320x161.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-486x245.png 486w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-674x340.png 674w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-892x450.png 892w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-991x500.png 991w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_09-520x262.png 520w" sizes="auto, (max-width: 669px) 100vw, 669px" /></p>
<p>2. Create a new folder called Samples where we will upload our sample data file.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3264" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10.png" alt="" width="675" height="175" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10.png 1299w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-150x39.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-300x78.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-768x199.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-1024x265.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-160x41.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-320x83.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-520x135.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-720x186.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_10-980x253.png 980w" sizes="auto, (max-width: 675px) 100vw, 675px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3265" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11.png" alt="" width="320" height="155" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11.png 547w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-150x73.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-300x145.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-160x78.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-320x155.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-506x245.png 506w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_11-520x252.png 520w" sizes="auto, (max-width: 320px) 100vw, 320px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3266" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12.png" alt="" width="572" height="200" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12.png 940w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-150x53.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-300x105.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-768x269.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-160x56.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-320x112.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-520x182.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_12-720x252.png 720w" sizes="auto, (max-width: 572px) 100vw, 572px" /></p>
<p>3. After the folder is ready double click it to open and then press the <em>Upload</em> button and select the file 500000 Sales Records.csv you have downloaded and unzipped before.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3267" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13.png" alt="" width="672" height="181" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13.png 950w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-150x40.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-300x81.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-768x207.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-160x43.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-320x86.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-520x140.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_13-720x194.png 720w" sizes="auto, (max-width: 672px) 100vw, 672px" /></p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3268" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14.png" alt="" width="676" height="242" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14.png 942w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-150x54.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-300x107.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-768x275.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-160x57.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-320x114.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-520x186.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_14-720x258.png 720w" sizes="auto, (max-width: 676px) 100vw, 676px" /></p>
<p>Uploading the file can take some time based on your connection speed. You can observe the progress and when the task is completed notification will popup.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3269" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15.png" alt="" width="674" height="263" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15.png 942w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-150x59.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-300x117.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-768x300.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-160x63.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-320x125.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-520x203.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15-720x281.png 720w" sizes="auto, (max-width: 674px) 100vw, 674px" /></p>
<p>When the file was successfully uploaded navigate back to the Samples folder and double click file name.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3377" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1.png" alt="" width="681" height="139" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1.png 1441w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-150x31.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-300x61.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-768x157.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-1024x209.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-160x33.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-320x65.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-520x106.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-720x147.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-980x200.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_1-1320x269.png 1320w" sizes="auto, (max-width: 681px) 100vw, 681px" /></p>
<p>It will open the file and previews its content. But at a first look, the text isn&#8217;t divided into columns. You can fix it in a minute: just click the Format button and select semicolon as column divider and mark the first row as containing column names. Azure will format file content as you can see in the picture:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3378" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2.png" alt="" width="691" height="229" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2.png 1601w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-150x50.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-300x100.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-768x255.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-1024x340.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-160x53.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-320x106.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-520x173.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-720x239.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-980x326.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_15_2-1320x439.png 1320w" sizes="auto, (max-width: 691px) 100vw, 691px" /></p>
<p>At this stage, we have successfully prepared our sample data in Azure Data Lake Storage and is time to do some basic data analysis over the data set.</p>
<h3>Create a new Data Lake Analytics job and query our data with U-SQL</h3>
<p>1. Navigate to the All resources menu item in the left panel of Azure Portal and select the Data Lake Analytics services we have created in previous steps. Once the window with its detail popup, press the button <em>New job</em> to create your first data analytics job.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3270" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16.png" alt="" width="644" height="301" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16.png 1776w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-150x70.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-300x140.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-768x359.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-1024x479.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-160x75.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-320x150.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-520x243.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-720x336.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-963x450.png 963w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_16-1070x500.png 1070w" sizes="auto, (max-width: 644px) 100vw, 644px" /></p>
<p>In the box below is a sample U-SQL script. You only need to copy/paste it to New job window like in the following picture. An explanation of the script can be found there. In a few words, we will load the content of the file with a text extractor, summarize the total number of Units Sold by Region and save the output to another text file in the same folder.</p>
<pre class="EnlighterJSRAW" data-enlighter-language="sql">@sales = 
    EXTRACT Region string, 
            Country string,
            [Item Type] string,
            [Sales Channel] string,
            [Order Priority] string,
            [Order Date] DateTime,
            [Order ID] int,
            [Ship Date] DateTime,
            [Units Sold] int,
            [Unit Price] decimal,
            [Unit Cost] decimal,
            [Total Revenue] decimal,
            [Total Cost] decimal,
            [Total Profit] decimal
    FROM "/Samples/500000%20Sales%20Records.csv"
    USING Extractors.Text(delimiter: ';', skipFirstNRows: 1);

@agg = 
  SELECT
    Region,
    SUM([Units Sold]) AS UnitsSold
  FROM @sales
  GROUP BY Region;

OUTPUT @agg
    TO "/Samples/UnitsSoldByRegion_output.csv"
    USING Outputters.Csv(outputHeader : true);</pre>
<p>2. Paste the script and enter the name of the job: UnitsSoldByRegion. Press Submit button and the job will be created and immediately queued for processing.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3271" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17.png" alt="" width="760" height="639" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17.png 1125w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-119x100.png 119w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-300x252.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-768x646.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-1024x861.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-160x135.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-320x269.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-291x245.png 291w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-404x340.png 404w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-535x450.png 535w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-595x500.png 595w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_17-520x437.png 520w" sizes="auto, (max-width: 760px) 100vw, 760px" /></p>
<p>There are three statuses of job processing: Preparation, Queued, and Running. You can observe the progress graphically in the right window where is processing plan available:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3272" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18.png" alt="" width="771" height="574" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18.png 1103w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-134x100.png 134w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-300x223.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-768x572.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-1024x762.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-160x119.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-320x238.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-329x245.png 329w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-457x340.png 457w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-605x450.png 605w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-672x500.png 672w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_18-520x387.png 520w" sizes="auto, (max-width: 771px) 100vw, 771px" /></p>
<p>After the job has been completed you can click on the last box in the processing steps chart. This will navigate you to the results file.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3273" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19.png" alt="" width="717" height="393" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19.png 917w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-150x82.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-300x165.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-768x421.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-160x88.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-320x176.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-447x245.png 447w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-620x340.png 620w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-820x450.png 820w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-912x500.png 912w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_19-520x285.png 520w" sizes="auto, (max-width: 717px) 100vw, 717px" /></p>
<p>Press the Data button and observe file content:</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3274" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20.png" alt="" width="571" height="349" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20.png 884w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-150x92.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-300x183.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-768x469.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-160x98.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-320x195.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-401x245.png 401w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-557x340.png 557w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-737x450.png 737w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-819x500.png 819w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_20-520x318.png 520w" sizes="auto, (max-width: 571px) 100vw, 571px" /></p>
<p>This is exactly what we were trying to achieve: Total number of Units Sold by Region. Columns are named exactly as we have specified in the U-SQL script.</p>
<p>If you will navigate back to Azure Data Lake Storage you will see our output file there.</p>
<p><img loading="lazy" decoding="async" class="alignnone wp-image-3275" src="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21.png" alt="" width="722" height="184" srcset="https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21.png 1446w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-150x38.png 150w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-300x76.png 300w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-768x195.png 768w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-1024x261.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-160x41.png 160w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-320x81.png 320w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-520x132.png 520w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-720x183.png 720w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-980x249.png 980w, https://sqlpowered.com/wp-content/uploads/2019/10/Azure_Data_Lake_Your_First_U_SQL_Query_21-1320x336.png 1320w" sizes="auto, (max-width: 722px) 100vw, 722px" /></p>
<p>That&#8217;s all. You have successfully configured your first Azure Data Lake Storage, uploaded some data into it, aggregated values using Azure Data Lake U-SQL language, and stored results in a text file.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/run-your-first-u-sql-script-in-azure-data-lake-step-by-step-tutorial/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Backup and restore database in Azure Storage Account</title>
		<link>https://sqlpowered.com/backup-and-restore-database-in-azure-storage-account/</link>
					<comments>https://sqlpowered.com/backup-and-restore-database-in-azure-storage-account/#respond</comments>
		
		<dc:creator><![CDATA[Jan Dvořák]]></dc:creator>
		<pubDate>Sat, 25 May 2019 06:56:19 +0000</pubDate>
				<category><![CDATA[Azure]]></category>
		<guid isPermaLink="false">https://sqlpowered.com/?p=3144</guid>

					<description><![CDATA[Creating backups of user databases from an on-premise environment to Azure Blob Storage is an easy task. You need to configure Storage Account in Azure where your database backups will be sent. Then you can reference this newly created storage container directly from SQL Server Management Studio when creating a...]]></description>
										<content:encoded><![CDATA[<p>Creating backups of user databases from an on-premise environment to Azure Blob Storage is an easy task. You need to configure Storage Account in Azure where your database backups will be sent. Then you can reference this newly created storage container directly from SQL Server Management Studio when creating a new backup. Same time you can generate T-SQL for later usage.</p>
<p>There are basic steps listed to accomplish this task:</p>
<p>1. Create a new SQL Server database that we will later backup to Azure Blob Storage. Name the database  CompanyData.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3147" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1.png" alt="" width="265" height="308" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1.png 265w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1-86x100.png 86w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1-258x300.png 258w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1-138x160.png 138w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-1-211x245.png 211w" sizes="auto, (max-width: 265px) 100vw, 265px" /></p>
<p>2. Then open the Backup data dialog as usual. Instead of Disk choose URL option in <em>Back up to</em> section.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3148" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2.png" alt="" width="1107" height="667" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2.png 1107w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-150x90.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-300x181.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-768x463.png 768w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-1024x617.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-160x96.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-320x193.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-407x245.png 407w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-564x340.png 564w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-747x450.png 747w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-830x500.png 830w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-2-520x313.png 520w" sizes="auto, (max-width: 1107px) 100vw, 1107px" /></p>
<p>3. In the next dialog press the button <em>New container</em> because we haven&#8217;t created it before in Storage Account. If you already have one then you can list for it.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3149" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3.png" alt="" width="718" height="174" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3.png 718w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3-150x36.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3-300x73.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3-160x39.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3-320x78.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-3-520x126.png 520w" sizes="auto, (max-width: 718px) 100vw, 718px" /></p>
<p>4. Next press <em>Sign In</em> in the next screen and sing in into your Azure subscription where your Storage Account was created.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3150" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4.png" alt="" width="882" height="534" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4.png 882w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-150x91.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-300x182.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-768x465.png 768w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-160x97.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-320x194.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-405x245.png 405w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-562x340.png 562w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-743x450.png 743w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-826x500.png 826w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-4-520x315.png 520w" sizes="auto, (max-width: 882px) 100vw, 882px" /></p>
<p>5. After you have signed in choose the right subscription, Storage Account, Blob Container, and press the button <em>Create Credential</em>. This will create the Shared Acess Signature (SAS).</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3151" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5.png" alt="" width="883" height="522" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5.png 883w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-150x89.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-300x177.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-768x454.png 768w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-160x95.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-320x189.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-414x245.png 414w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-575x340.png 575w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-761x450.png 761w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-846x500.png 846w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-5-520x307.png 520w" sizes="auto, (max-width: 883px) 100vw, 883px" /></p>
<p>6. When you have pressed OK in the previous step you are back in <em>Select Backup Destination </em>screen where you can see your Storage Account container successfully attached. Press the OK button.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3152" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6.png" alt="" width="717" height="173" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6.png 717w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6-150x36.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6-300x72.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6-160x39.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6-320x77.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-6-520x125.png 520w" sizes="auto, (max-width: 717px) 100vw, 717px" /></p>
<p>7. You can see that everything is ready for backup now. Press OK and the backup process will start like in backup to Disk scenario.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3153" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7.png" alt="" width="1107" height="667" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7.png 1107w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-150x90.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-300x181.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-768x463.png 768w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-1024x617.png 1024w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-160x96.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-320x193.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-407x245.png 407w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-564x340.png 564w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-747x450.png 747w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-830x500.png 830w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-7-520x313.png 520w" sizes="auto, (max-width: 1107px) 100vw, 1107px" /></p>
<p>The <em>Error occurred </em>icon in the picture will occur if you will try to press the <em>Script</em> button. Hopefully, this will be corrected soon in the nearest SSMS release. For now, we will capture the background query via Profiler:</p>
<pre class="lang:tsql decode:true">BACKUP DATABASE [CompanyData] TO  
URL = N'https://sqlpoweredbackups.blob.core.windows.net/sqlbackups/companydata_backup_2019_05_25_081859.bak' 
WITH NOFORMAT, NOINIT,
NAME = N'CompanyData-Full Database Backup', 
NOSKIP, NOREWIND, NOUNLOAD,  
STATS = 10
GO</pre>
<p>8. You can use Azure Storage Explorer to check that our backup file exists in the target  Azure Blob Storage container.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3158" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9.png" alt="" width="1014" height="598" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9.png 1014w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-150x88.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-300x177.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-768x453.png 768w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-160x94.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-320x189.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-415x245.png 415w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-577x340.png 577w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-763x450.png 763w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-848x500.png 848w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-9-520x307.png 520w" sizes="auto, (max-width: 1014px) 100vw, 1014px" /></p>
<p>That&#8217;s it. Nothing complicated and very similar do Disk backup type.</p>
<p>You would like to where are your authentication credentials stored? In the BACKUP statement itself we have captured with Profiler there is no such reference. Your credentials were used to create the Shared Access Signature key that is located in the Credentials folder under Security parent for later use.</p>
<p><img loading="lazy" decoding="async" class="alignnone size-full wp-image-3154" src="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8.png" alt="" width="554" height="306" srcset="https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8.png 554w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-150x83.png 150w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-300x166.png 300w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-160x88.png 160w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-320x177.png 320w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-444x245.png 444w, https://sqlpowered.com/wp-content/uploads/2019/05/Backup-Restore-To-Azure-8-520x287.png 520w" sizes="auto, (max-width: 554px) 100vw, 554px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlpowered.com/backup-and-restore-database-in-azure-storage-account/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
