{"id":104164,"date":"2024-10-16T17:00:00","date_gmt":"2024-10-16T17:00:00","guid":{"rendered":"https:\/\/www.red-gate.com\/simple-talk\/?p=104164"},"modified":"2026-10-16T12:30:34","modified_gmt":"2026-10-16T12:30:34","slug":"using-a-service-account-in-microsoft-fabric","status":"publish","type":"post","link":"https:\/\/www.red-gate.com\/simple-talk\/data-analytics\/microsoft-fabric\/using-a-service-account-in-microsoft-fabric\/","title":{"rendered":"Using a Service Account in Microsoft Fabric"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Applications should never depend on user accounts for their own authentication. User accounts have unique security configurations, such as MFA and password expiration. See also <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/choosing-between-the-lakehouse-and-warehouse-in-microsoft-fabric\/\">lakehouse vs warehouse in Fabric.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Applications can&#8217;t manage this kind of unique configuration. When the user changes the password, for example, the application may stop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The solution for this is to give to the application their own identity. The application needs to be capable to use this kind of identity, which is called a Service Account. For more on this, see<a href=\"https:\/\/www.red-gate.com\/simple-talk\/data-analytics\/microsoft-fabric\/using-a-service-account-in-microsoft-fabric\/\"> authenticating with a service account in Fabric.<\/a><\/p>\n\n\n\n<h2 id=\"h-service-accounts-support-in-fabric\" class=\"wp-block-heading\">Service Accounts support in Fabric<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/www.linkedin.com\/pulse\/cloud-connections-microsoft-fabric-dtower-software-4hgzf\/\" target=\"_self\" rel=\"noopener\">Cloud connections in Fabric<\/a> support the usage of service accounts. After we publish our semantic models, we can link them with the cloud connections configured to use the service accounts. For more on this, see <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/using-virtual-network-data-gateways-to-secure-access-to-azure-sql-in-power-bi\/\">securing Power BI access to Azure SQL with a VNet data gateway.<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When creating a new cloud connection, Service Account is one of the authentication options. When we choose this option, we need to fill in the <strong>Tenant Id<\/strong>, <strong>Service Principal Id<\/strong> and <strong>Service principal key<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"307\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-5.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104165\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 id=\"h-creating-a-service-account\" class=\"wp-block-heading\">Creating a Service Account<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Fabric and Azure environment are related by the same security system: a single directory managing all the authentication.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this directory, the process to create a service account is called <strong>App Registration<\/strong>: You will register an app in Azure Entra (former Azure Active Directory) and this app will become a user which can receive permissions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1: Navigate to &#8220;App registrations&#8221;<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In Azure Portal, App Registrations is inside the <strong>Entra ID<\/strong> feature (former Azure Active Directory). You can reach it by searching on the top search box, or going to Entra Id and finding it in the left menu.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2: Create a New App Registration<\/strong><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>In the App registrations page, click on the &#8220;+ New registration&#8221; button at the top of the page.<\/li>\n<\/ul>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"633\" height=\"388\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-6.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104166\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3: Configure the App Registration<\/strong><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Name: Enter a name for your application. This name will help identify the app in your Azure portal.<\/li>\n\n\n\n<li>Click &#8220;Register&#8221; to complete the registration.<\/li>\n<\/ul>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"840\" height=\"214\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-error-description-auto.png\" alt=\"A screenshot of a computer error\n\nDescription automatically generated\" class=\"wp-image-104167\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Step 4: Note Down Important Information<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">After the app registration is created, you will be redirected to the app&#8217;s Overview page. Note the following key information:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Application (client) ID<\/strong>: This is a unique identifier for your app.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Directory (tenant) ID<\/strong>: This is the unique identifier for your Azure AD tenant.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5: Generate a Client Secret<\/strong><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>In the left menu, go to &#8220;Certificates &amp; secrets&#8221;.<\/li>\n\n\n\n<li>Under Client secrets, click &#8220;+ New client secret&#8221;.<\/li>\n<\/ul>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"339\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-7.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104168\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Provide a description and select the expiration period for the secret.<\/li>\n<\/ul>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"568\" height=\"140\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-8.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104169\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n<div class=\"block-core-list\">\n<ul class=\"wp-block-list\">\n<li>Click &#8220;Add&#8221;.<\/li>\n<\/ul>\n<\/div>\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1059\" height=\"339\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-9.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104170\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Once created, copy the Value of the client secret immediately, as it will not be displayed again.<\/p>\n\n\n\n<h2 id=\"h-service-account-configuration-values\" class=\"wp-block-heading\">Service Account Configuration Values<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After following the steps to create a service account, you have the <strong>Tenant Id<\/strong>, <strong>Service Principal Id<\/strong> and <strong>Service principal key<\/strong> for the service account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When creating a Cloud Connection in Fabric, these are the values you need to fill.<\/p>\n\n\n\n<h2 id=\"h-enabling-service-accounts-usage-in-fabric\" class=\"wp-block-heading\">Enabling Service Accounts usage in Fabric<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Service Accounts in Fabric need to be enabled before they receive any permission.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, let&#8217;s imagine you would like to use a service account to connect to a lakehouse. The service account needs to receive access to the lakehouse. The first step is to enable service accounts to access Fabric resources. See also <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/how-to-build-metadata-driven-pipelines-in-microsoft-fabric\/\">building metadata-driven pipelines in Fabric<\/a>, the pipeline that would run under this account.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the service account will be used only for external connections, you may not need this, but usually you will need the service account to access Fabric resources as well.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In order to enable the access of the service account, you need to use Power BI\/Fabric admin portal. Inside the admin portal, locate the <strong>Service principals can use Fabric APIs<\/strong>. This option needs to be enabled. For more on this, see <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/using-virtual-network-data-gateways-to-secure-access-to-azure-sql-in-power-bi\/\">securing Power BI access to Azure SQL with a VNet data gateway.<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"599\" height=\"547\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-10.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104171\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 id=\"h-setting-permissions-to-the-service-account\" class=\"wp-block-heading\">Setting Permissions to the Service Account<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Defining the permissions to service accounts is like doing so for regular users. You can define it on workspace level or object level. For more on this, see <a href=\"https:\/\/www.red-gate.com\/simple-talk\/data-analytics\/microsoft-fabric\/granting-permissions-in-a-fabric-data-warehouse-and-lakehouse\/\">granting permissions in a Fabric warehouse and lakehouse<\/a>. See also <a href=\"https:\/\/www.red-gate.com\/simple-talk\/other\/microsoft-fabric-using-vs-code-to-develop-notebooks\/\">developing Fabric notebooks in VS Code<\/a>, the notebook that would authenticate with it. For more on this, see <a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/choosing-between-the-lakehouse-and-warehouse-in-microsoft-fabric\/\">choosing between a lakehouse and a warehouse in Fabric.<\/a><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"340\" height=\"274\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-11.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104172\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"718\" height=\"408\" src=\"https:\/\/www.red-gate.com\/simple-talk\/wp-content\/uploads\/2024\/10\/a-screenshot-of-a-computer-description-automatica-12.png\" alt=\"A screenshot of a computer\n\nDescription automatically generated\" class=\"wp-image-104173\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<h2 id=\"h-summary\" class=\"wp-block-heading\">Summary<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Service accounts improve the security and stability of Fabric environment, removing the dependencies with user accounts. See also<a href=\"https:\/\/www.red-gate.com\/simple-talk\/databases\/sql-server\/bi-sql-server\/how-to-build-metadata-driven-pipelines-in-microsoft-fabric\/\"> a metadata-driven Fabric pipeline.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Applications should never depend on user accounts for their own authentication. User accounts have unique security configurations, such as MFA and password expiration. See also lakehouse vs warehouse in Fabric. Applications can&#8217;t manage this kind of unique configuration. When the user changes the password, for example, the application may stop. The solution for this is&#8230;&hellip;<\/p>\n","protected":false},"author":50808,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[159164,2],"tags":[123648,158997,101611,4619],"coauthors":[6810],"class_list":["post-104164","post","type-post","status-publish","format-standard","hentry","category-microsoft-fabric","category-other","tag-data-platform","tag-microsoft-fabric","tag-power-bi","tag-security"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/users\/50808"}],"replies":[{"embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/comments?post=104164"}],"version-history":[{"count":10,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104164\/revisions"}],"predecessor-version":[{"id":113845,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/posts\/104164\/revisions\/113845"}],"wp:attachment":[{"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/media?parent=104164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/categories?post=104164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/tags?post=104164"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.red-gate.com\/simple-talk\/wp-json\/wp\/v2\/coauthors?post=104164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}