<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Variable Libraries on Hat Full of Data</title><link>https://hatfullofdata.blog/categories/variable-libraries/</link><description>Recent content in Variable Libraries on Hat Full of Data</description><generator>Hugo -- gohugo.io</generator><language>en-gb</language><lastBuildDate>Wed, 11 Feb 2026 17:21:27 +0000</lastBuildDate><atom:link href="https://hatfullofdata.blog/categories/variable-libraries/index.xml" rel="self" type="application/rss+xml"/><item><title>Using Variable Library in a Dataflow</title><link>https://hatfullofdata.blog/using-variable-library-in-a-dataflow/</link><pubDate>Wed, 11 Feb 2026 17:21:24 +0000</pubDate><guid>https://hatfullofdata.blog/using-variable-library-in-a-dataflow/</guid><description>&lt;img src="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/cover.png" alt="Featured image of post Using Variable Library in a Dataflow" /&gt;&lt;p&gt;One of the popular low-code tools within Microsoft Fabric is the Gen2 Dataflow. Power BI report builders already know some Power Query. So armed with this knowledge is a popular starting point to load data into Microsoft Fabric. Adding values from the Variable Library in a Dataflow is an obvious plan to make it more future proof and to work better with Deployment pipelines.&lt;/p&gt;
&lt;p&gt;I will confess the first time I tried these I could not get them to work till I read the instructions correctly. So they do work just understand the limitations!&lt;/p&gt;
&lt;h2&gt;Variable Library Series&lt;/h2&gt;
&lt;p&gt;Variable libraries should be part of every project. This post is part of my series to help get you started creating the library and then using the variables and finally seeing your hard work pay back when it comes to deployment pipelines.&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/variable-library/"&gt;Getting started with variable libraries&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/"&gt;Variable Values in a Fabric Notebook&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/"&gt;Variable Values in a Data Pipeline&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/"&gt;Variable Values in Lakehouse Shortcuts&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Variable Values in Dataflows&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=""&gt;Variable Libraries in Deployment Pipelines&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="scenario"&gt;Scenario
&lt;/h2&gt;&lt;p&gt;For this post we are going to use the scenario of a dataflow query that lists projects. Whilst we are developing the data handling we want to limit the number of rows loaded and in production we will have no limit.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen grab of the steps described in the next paragraph." class="gallery-image" data-flex-basis="379px" data-flex-grow="158" height="430" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/image.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;I create the dataflow and then using Keep Rows, I select Keep top rows. In the next dialog I enter 5 and click OK. This results in a table with only 5 rows of data. The number of rows though needs to come from the variable library.&lt;/p&gt;
&lt;h2 id="getting-the-value"&gt;Getting the Value
&lt;/h2&gt;&lt;p&gt;The next step is to get the value from the variable library into the dataflow. We are going to use a new Power Query function for this called &lt;strong&gt;Variable.ValueOrDefault&lt;/strong&gt;. For the first parameter of this function, you need the Variable Library name and a Variable name. Then you combine together in a string.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;$(/**/&amp;lt;Library Name&amp;gt;/&amp;lt;Variable Name&amp;gt;)&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;So for my example the string will be &lt;strong&gt;“$(/**/Finance Variables/Limit)”&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt="snapshots of getting the variable value from variable library in a dataflow" class="gallery-image" data-flex-basis="582px" data-flex-grow="242" height="280" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/image-1.png" width="680"&gt;&lt;/p&gt;
&lt;blockquote class="alert alert-note"&gt;
 &lt;div class="alert-header"&gt;
 &lt;span class="alert-icon"&gt;📝&lt;/span&gt;
 &lt;span class="alert-title"&gt;Instructions&lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="alert-body"&gt;
 &lt;ol&gt;
&lt;li&gt;On the Home ribbon, expand Get data and select Blank query.&lt;/li&gt;
&lt;li&gt;Rename the query to DataRows.&lt;/li&gt;
&lt;li&gt;Then in the formula bar enter in the code below.&lt;/li&gt;
&lt;li&gt;This will return the current value of the variable in the library.&lt;/li&gt;
&lt;/ol&gt;
 &lt;/div&gt;
 &lt;/blockquote&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Variable.ValueOrDefault(&amp;#34;$(/**/Finance Variables/Limit)&amp;#34;,2)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;blockquote class="alert alert-tip"&gt;
 &lt;div class="alert-header"&gt;
 &lt;span class="alert-icon"&gt;💡&lt;/span&gt;
 &lt;span class="alert-title"&gt;Tip&lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="alert-body"&gt;
 &lt;p&gt;The documentation as of publishing this post states it won’t work hence we use the OrDefault function and in this example the default is 2. It does work though, and we can see the answer 8 comes through.&lt;/p&gt;
 &lt;/div&gt;
 &lt;/blockquote&gt;
&lt;h2 id="using-the-variable-value"&gt;Using the Variable Value
&lt;/h2&gt;&lt;p&gt;We’ve got the variable value from the variable library in a dataflow, now we need to use it. In the last line of my project query that limited the query to 5 rows I can replace the 5 with DataRows. I now get 8 rows of data.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of the data table showing there are only 8 rows of data" class="gallery-image" data-flex-basis="468px" data-flex-grow="195" height="348" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/image-2.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;This works as long as we always want to limit the rows, the chances are in production we don’t want to limit, so I add the extra of only limit if DataRows is greater than 0. Here is my new statement, the previous step is call Sorted Rows hence the #”Sorted rows”&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;if DataRows &amp;gt; 0 then Table.FirstN(#&amp;#34;Sorted rows&amp;#34;, DataRows) else #&amp;#34;Sorted rows&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="references-for-variable-library-in-a-dataflow"&gt;References for Variable Library in a Dataflow
&lt;/h2&gt;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-variable-library-integration?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;Microsoft – Use Fabric variable libraries in Dataflow Gen2&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/powerquery-m/variable-valueordefault?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;Power Query Reference for Variable.ValueOrDefault&lt;/a&gt;&lt;/p&gt;
&lt;h2 id="conclusion-on-using-variable-library-in-a-dataflow"&gt;Conclusion on using variable library in a dataflow
&lt;/h2&gt;&lt;p&gt;Its great we can bring in the values easily. Its a shame that we can’t use them to control the destination, but that is on the road map for 2026 Q1. I’ll blog about it as soon as it arrives! I highly recommend using my pattern of fetching the value as a query and then referring to that. It will help in debugging etc.&lt;/p&gt;</description></item><item><title>Using a Variable Library in Lakehouse Shortcuts</title><link>https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/</link><pubDate>Mon, 26 Jan 2026 18:43:51 +0000</pubDate><guid>https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/</guid><description>&lt;img src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/cover.png" alt="Featured image of post Using a Variable Library in Lakehouse Shortcuts" /&gt;&lt;p&gt;Lakehouse shortcuts are a popular addition to the Fabric set of tools to access data easily without copying it. Using a variable library in lakehouse shortcuts means its easy to point shortcuts to an alternative location. This great for ALM using development, test and production workspaces.&lt;/p&gt;
&lt;h2&gt;Variable Library Series&lt;/h2&gt;
&lt;p&gt;Variable libraries should be part of every project. This post is part of my series to help get you started creating the library and then using the variables and finally seeing your hard work pay back when it comes to deployment pipelines.&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/variable-library/"&gt;Getting started with variable libraries&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/"&gt;Variable Values in a Fabric Notebook&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/"&gt;Variable Values in a Data Pipeline&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Variable Values in Lakehouse Shortcuts&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/"&gt;Variable Values in Dataflows&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=""&gt;Variable Libraries in Deployment Pipelines&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="setting-up-the-shortcuts"&gt;Setting Up the Shortcuts
&lt;/h2&gt;&lt;p&gt;Using the standard GUI you have no option to use a variable library values in the setup of the shortcuts. So set up your shortcuts as you normally and make sure they work. For this post I’m using a shortcut to a table in warehouse. (I had a whole barny with lakehouses and schemas and it not working – another post for another time!)&lt;/p&gt;
&lt;p&gt;&lt;img alt="snapshot of a projects shortcut in the explorer pane." class="gallery-image" data-flex-basis="577px" data-flex-grow="240" height="416" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-12.png" srcset="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-12_hu_3c99a595335523c2.png 800w, https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-12.png 1001w" width="1001"&gt;&lt;/p&gt;
&lt;p&gt;According to the documentation using the rest API also does not allow for the use of variables in the creation of shortcuts.&lt;/p&gt;
&lt;h2 id="viewing-the-options"&gt;Viewing the Options
&lt;/h2&gt;&lt;p&gt;If we select the short cut and click on the 3 dots to expand the menu we can then click on Manage Shortcut. This opens a pan that shows the values behind the shortcut. The values that be populated from a variable library have a Variable drop down, so we can see Target workspace, Target item and Target path.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of the exploere and manage shortcut panes" class="gallery-image" data-flex-basis="292px" data-flex-grow="121" height="558" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-13.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;I only want to populate the workspace and item guids, so I set up a those variables in my variable library. The variables must be set up as strings, they might look like guids but the shortcut demands they are strings. I set the default values to match the current values. When we apply each variables it will check the current values work so it only works if you use the current values.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of the variable library" class="gallery-image" data-flex-basis="620px" data-flex-grow="258" height="263" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-15.png" width="680"&gt;&lt;/p&gt;
&lt;h2 id="applying-the-variables"&gt;Applying the Variables
&lt;/h2&gt;&lt;p&gt;Back in the Manage Shortcut pane click on the Variable below the current value to expand that section. Then click on Select variable to open the Select variable dialog. Click on the correct variable and then click Select Variable. This will update the value to come from the variable.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshots of clicking on select variable and selecting the right one" class="gallery-image" data-flex-basis="538px" data-flex-grow="224" height="303" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/image-16.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;Once you have pointed it to the variable there does not appear to be a method to change back to a hard coded value.&lt;/p&gt;
&lt;h2 id="updating-variable-values"&gt;Updating Variable Values
&lt;/h2&gt;&lt;p&gt;Variable values will get updated, the most common being a different active set being selected. For other artifacts the change will get picked up when they execute or refresh. For shortcuts this is slightly different. You need to force the updating of variables.&lt;/p&gt;
&lt;p&gt;Open the lakehouse and stay in the lakehouse view. On the ribbon the last button is Update all variables. A message will show the updating is taking and finally there will be a notification to say they have been updated.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Updating variable library in lakehouse shortcuts" class="gallery-image" data-flex-basis="228px" data-flex-grow="95" height="682" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/2026-01-26_16-40-32.png" width="648"&gt;&lt;/p&gt;
&lt;p&gt;If one of the shortcut fails in the update please be aware the successful ones will have updated. You do get a notification and an error message that tries to help.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshots of updatings the variables" class="gallery-image" data-flex-basis="361px" data-flex-grow="150" height="451" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/2026-01-26_16-58-29.png" width="680"&gt;&lt;/p&gt;
&lt;h2 id="conclusion-on-variable-library-in-lakehouse-shortcuts"&gt;Conclusion on Variable Library in Lakehouse Shortcuts
&lt;/h2&gt;&lt;p&gt;I really like that the variable libraries can be accessed directly in the shortcut details, there is no pre-loading. I would prefer that I could change the values and then press apply so that each value isn’t checked individually. My experience in deployment pipelines means I fell foul of not realising I needed to refresh the variable values.&lt;/p&gt;
&lt;h2 id="resources"&gt;Resources
&lt;/h2&gt;&lt;p&gt;Creating Shortcuts – &lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/data-engineering/lakehouse-shortcuts?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/en-us/fabric/data-engineering/lakehouse-shortcuts&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Microsoft Learn – &lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/onelake/assign-variables-to-shortcuts?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/en-us/fabric/onelake/assign-variables-to-shortcuts&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Using a Variable Library in a Data Pipeline</title><link>https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/</link><pubDate>Mon, 19 Jan 2026 10:36:26 +0000</pubDate><guid>https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/</guid><description>&lt;img src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/cover.png" alt="Featured image of post Using a Variable Library in a Data Pipeline" /&gt;&lt;p&gt;You’ve set up your variable pipeline with WorkspaceIDs and LakehouseIDs etc etc Now you want to use that variable library in a data pipeline so we can use the common values and they will behave in a deployment pipeline.&lt;/p&gt;
&lt;h2&gt;Variable Library Series&lt;/h2&gt;
&lt;p&gt;Variable libraries should be part of every project. This post is part of my series to help get you started creating the library and then using the variables and finally seeing your hard work pay back when it comes to deployment pipelines.&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/variable-library/"&gt;Getting started with variable libraries&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/"&gt;Variable Values in a Fabric Notebook&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Variable Values in a Data Pipeline&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/"&gt;Variable Values in Lakehouse Shortcuts&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/"&gt;Variable Values in Dataflows&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=""&gt;Variable Libraries in Deployment Pipelines&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="adding-the-variables-to-the-data-pipeline"&gt;Adding the Variables to the Data Pipeline
&lt;/h2&gt;&lt;p&gt;Before you can use the variable library in a data pipeline you need to add the variables. In your data pipeline you need to click on the grey background to bring up the section on the bottom of the screen with Parameters, Variables etc. If you are in a brand new pipeline you need to click on the settings cog first, then it will appear.&lt;/p&gt;
&lt;p&gt;Select the Library Variables section. Then click on +New and the select variable dialog box appears. If you have multiple variable libraries you can select the right one, you can also search for a variable in the top right. Once you select a variable click on Select Variable button to add that variable to the pipeline.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shot showing the Library values section in the pipeline. The the steps to add a variable from a variable library to a data pipelines" class="gallery-image" data-flex-basis="482px" data-flex-grow="201" height="338" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/Variable-Library-003.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;Yes you have to add each variable in turn, no multi-select. You can rename the variables but please don’t, name your variables in your library better.&lt;/p&gt;
&lt;h2 id="using-variable-values"&gt;Using Variable Values
&lt;/h2&gt;&lt;p&gt;You can use the variable values anywhere you can use Dynamic Content. Click on the Add Dynamic content link to open the Pipeline expression builder. Click on the three dots to select Library variables. Click on the variable value you want to use to enter in the formula into the expression. Click OK to put the formula back into the box.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screenshot of adding dynamic content to get Variable Values" class="gallery-image" data-flex-basis="426px" data-flex-grow="177" height="383" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/Variable-Library-004.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;You can use the variable value inside any functions if required.&lt;/p&gt;
&lt;h2 id="using-variables-for-data-connections"&gt;Using Variables for Data Connections
&lt;/h2&gt;&lt;p&gt;When a data pipeline move from a dev workspace to test workspace and then onto production workspace we need to change the details of the connections to the new values. For this post we will use a connection to a Fabric warehouse in a workspace. I want to pull the values from a table in the warehouse using a lookup action.&lt;/p&gt;
&lt;p&gt;I need to create the following variables in the library:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Project_Warehouse_Connection_ID&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Project_Workspace_ID&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Project_Warehouse_ID&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Project_Warehouse_Connection_String&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="connection-ids"&gt;Connection IDs
&lt;/h3&gt;&lt;p&gt;For the connection guid you need to click on the cog on the top bar and select Manage connections and gateways. From the list of connections, find the one you are using. From the three dots menu select settings. The Connection ID will be listed and can be highlighted and copied.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shots of the steps to get a connection ID" class="gallery-image" data-flex-basis="265px" data-flex-grow="110" height="614" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/image-7.png" width="680"&gt;&lt;/p&gt;
&lt;h3 id="workspace-warehouse-and-lakehouse-ids"&gt;Workspace, Warehouse and Lakehouse IDs
&lt;/h3&gt;&lt;p&gt;IDs for most artifacts can be found when it is opened. Be aware groups=workspaces in the url. Lakehouses have 2 IDs, one for the lakehouse and one for the SQL analytics endpoint or lakewarehouse as the url names it. No comment on names to confuse us!&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screenshot of the address bar in a browser highlighting the Workspace ID and Warehouse ID" class="gallery-image" data-flex-basis="1833px" data-flex-grow="764" height="89" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/image-8.png" width="680"&gt;&lt;/p&gt;
&lt;h3 id="connection-string"&gt;Connection String
&lt;/h3&gt;&lt;p&gt;The final part needed is the connection string for the warehouse or lakehouse. The easiest way to copy this is to open the lakehouse SQL endpoint or the warehouse and in the bottom left hand corner is a Copy SQL connection string link.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screen shot of the Copy SQL coonnection string link" class="gallery-image" data-flex-basis="716px" data-flex-grow="298" height="189" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/image-9.png" width="564"&gt;&lt;/p&gt;
&lt;p&gt;It can also be found in the lakehouse or warehouse settings under SQL analytics endpoint.&lt;/p&gt;
&lt;h3 id="variable-library"&gt;Variable Library
&lt;/h3&gt;&lt;p&gt;All these values need saving into the Variable Library. I’ve used Guid for the IDs and String for the connection string.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shot of the Finance_Variables variable library with the 4 variables setup." class="gallery-image" data-flex-basis="473px" data-flex-grow="197" height="344" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/image-10.png" width="679"&gt;&lt;/p&gt;
&lt;h2 id="using-the-variables-in-the-activities"&gt;Using the Variables in the Activities
&lt;/h2&gt;&lt;p&gt;We now need to use the variable values from the variable library in a data pipeline activity connection. We start by adding all 4 variables to the library. Note the guids become strings.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shot of the Library variables from the variable library in a data pipeline settings." class="gallery-image" data-flex-basis="549px" data-flex-grow="228" height="297" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/image-11.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;In this post for simplicity I’m using a Lookup activity to just get all the rows from the projects table. So I add a lookup activity and fill in the general details. On the Settings tab I click the drop down for Connection and select Use dynamic content. In the Add dynamic content pane I find Library Variables under the three dots and select FinanceVariables_Warehouse_Connection_ID so it appears in the expression box. Then I click OK for the Connection to now be an expression.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screenshots of the steps described in the previous paragraph." class="gallery-image" data-flex-basis="398px" data-flex-grow="165" height="410" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/Variable-Library-006.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;Once the connection has been populated you can select the connection type, in my case Warehouse. Then the text boxes appear to take the Workspace ID, Warehouse ID and SQL Connection string. They all have a link to Add dynamic content.&lt;/p&gt;
&lt;p&gt;&lt;img class="gallery-image" data-flex-basis="496px" data-flex-grow="206" height="329" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/Variable-Library-007.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;The table drop down can be populated by entering manually or by clicking Refresh. This will open a pane showing the values that are going to be used in the connection. Click OK to start it fetching the list of tables. Once a table is selected if you click Preview data the same pane appears confirming values. Its a great way to test the connection works.&lt;/p&gt;
&lt;p&gt;You now have a variable values from a variable library in a data pipeline activity. Well done!&lt;/p&gt;
&lt;h2 id="conclusion-on-using-a-variable-library-in-a-data-pipeline"&gt;Conclusion on Using a Variable Library in a Data Pipeline
&lt;/h2&gt;&lt;p&gt;I like how simple it is to use the variables and that you get to select the variables needed in this data pipeline. I’d prefer if you could add multiple variables at a time. I like the consitent use of the expression builder so its something we get familiar with.&lt;/p&gt;
&lt;p&gt;I’d also really like it if in lineage view you could see which artifacts are using of the variable library and the impact was also included. Maybe oneday!&lt;/p&gt;
&lt;h2 id="resources"&gt;Resources
&lt;/h2&gt;&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/data-factory/variable-library-integration-with-data-pipelines?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/en-us/fabric/data-factory/variable-library-integration-with-data-pipelines&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Accessing a Variable Library in a Notebook</title><link>https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/</link><pubDate>Mon, 12 Jan 2026 09:34:51 +0000</pubDate><guid>https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/</guid><description>&lt;img src="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/cover.png" alt="Featured image of post Accessing a Variable Library in a Notebook" /&gt;&lt;p&gt;This post walks through how to access a variable library in a notebook in Microsoft Fabric. I recommend a Microsoft Fabric project starts by creating a variable library to store the common values different artifacts need and could be changed if a deployment pipeline gets involved. So when we create a notebook we need to be able to use these variables. This means we need load the variable library in a notebook and then get the variable values.&lt;/p&gt;
&lt;h2&gt;Variable Library Series&lt;/h2&gt;
&lt;p&gt;Variable libraries should be part of every project. This post is part of my series to help get you started creating the library and then using the variables and finally seeing your hard work pay back when it comes to deployment pipelines.&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/variable-library/"&gt;Getting started with variable libraries&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;strong&gt;Variable Values in a Fabric Notebook&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/"&gt;Variable Values in a Data Pipeline&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/"&gt;Variable Values in Lakehouse Shortcuts&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/"&gt;Variable Values in Dataflows&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=""&gt;Variable Libraries in Deployment Pipelines&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="connect-to-library"&gt;Connect to Library
&lt;/h2&gt;&lt;p&gt;The first task is to create a variable for the variable library. The notebookutils package includes the functions we need to do this easily. In the code below the variable vl will refer to the variable library that is called “Finance Variables”. This code assumes the notebook is in the same workspace as the library.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Get the Variable library
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vl = notebookutils.variableLibrary.getLibrary(&amp;#34;Finance Variables&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;h2 id="get-variable-value"&gt;Get Variable Value
&lt;/h2&gt;&lt;p&gt;Once we have the variable library loaded, we can access the variable values in one of two syntaxes.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2 syntaxes to get variable value
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SP_URL = vl.getVariable(&amp;#34;SharePoint_URL&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Limit = vl.Limit
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Combining both of the two and adding some print statements we can demo the above using this code.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt; 1
&lt;/span&gt;&lt;span class="lnt"&gt; 2
&lt;/span&gt;&lt;span class="lnt"&gt; 3
&lt;/span&gt;&lt;span class="lnt"&gt; 4
&lt;/span&gt;&lt;span class="lnt"&gt; 5
&lt;/span&gt;&lt;span class="lnt"&gt; 6
&lt;/span&gt;&lt;span class="lnt"&gt; 7
&lt;/span&gt;&lt;span class="lnt"&gt; 8
&lt;/span&gt;&lt;span class="lnt"&gt; 9
&lt;/span&gt;&lt;span class="lnt"&gt;10
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Get the Variable library
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;vl = notebookutils.variableLibrary.getLibrary(&amp;#34;Finance Variables&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# 2 syntaxes to get variable value
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SP_URL = vl.getVariable(&amp;#34;SharePoint_URL&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Limit = vl.Limit
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Check results
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(f&amp;#34;{SP_URL=}&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;print(f&amp;#34;{Limit=}&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;And here is the run&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shot of the code loading variable library in a notebook and the results after it ran." class="gallery-image" data-flex-basis="576px" data-flex-grow="240" height="283" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/image-3.png" width="680"&gt;&lt;/p&gt;
&lt;h2 id="get-a-variable-value-by-reference"&gt;Get a variable value by reference
&lt;/h2&gt;&lt;p&gt;There is a third way to get a variable value. The get method from notebookutils variable library uses a reference string that follows the following syntax:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;$(/**/&lt;span class="nt"&gt;&amp;lt;LIBRARY&lt;/span&gt; &lt;span class="err"&gt;NAME&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="nt"&gt;&amp;lt;VARIABLE&lt;/span&gt; &lt;span class="err"&gt;NAME&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;)&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Before you get excited that the ** implies you could refer to another workspace, sorry that is not supported. This string is used in the variableLibrary.get action in notebookutils. For example to get the two values from before could be done like this&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-xml" data-lang="xml"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# Get the variable values directly
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;SP_URL = notebookutils.variableLibrary.get(&amp;#34;$(/**/Finance Variables/SharePoint_URL)&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Limit = notebookutils.variableLibrary.get(&amp;#34;$(/**/Finance Variables/Limit)&amp;#34;)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;And here is the run&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shot of the code loading variable library in a notebook using references and the results after it ran." class="gallery-image" data-flex-basis="788px" data-flex-grow="328" height="207" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/image-4.png" width="680"&gt;&lt;/p&gt;
&lt;blockquote class="alert alert-tip"&gt;
 &lt;div class="alert-header"&gt;
 &lt;span class="alert-icon"&gt;💡&lt;/span&gt;
 &lt;span class="alert-title"&gt;Tip&lt;/span&gt;
 &lt;/div&gt;
 &lt;div class="alert-body"&gt;
 &lt;p&gt;The print(f&amp;quot;{Limit=}&amp;quot;) prints Limit=4 for us newbies to Python!&lt;/p&gt;
 &lt;/div&gt;
 &lt;/blockquote&gt;
&lt;h2 id="naming-conventions"&gt;Naming Conventions
&lt;/h2&gt;&lt;p&gt;When you start and there are only 4 variables in the library its easy to remember the names to type in by hand when you are using a variable library in a notebook. When it gets to 20 names, its harder. So create standards, whats the case pattern, you using _ between words or not? Pick a set of rules and stick with it, BronzeWorkspaceID works just as well as Bronze_Workspace_ID, WorkspaceID1 and workspace_id2 are a technical debt you don’t need.&lt;/p&gt;
&lt;h2 id="conclusion-on-using-variable-library-in-a-notebook"&gt;Conclusion on using Variable Library in a Notebook
&lt;/h2&gt;&lt;p&gt;I’m really impressed on how easy it is to use the variable library in a notebook. The pattern is simple and resusable. If I had a magic wand it it would be great is the intellisense knew the variable names from loading the variable library object.&lt;/p&gt;
&lt;p&gt;The method by reference is great if you want to dynamically select which variable to load as the string could be dynamically built.&lt;/p&gt;
&lt;p&gt;Using a combination of parameters and accessing a variable library means reusable notebooks are easier to write. This needs to become part of the best practice pattern being used.&lt;/p&gt;
&lt;h2 id="references"&gt;References
&lt;/h2&gt;&lt;p&gt;Microsoft learn covers Variable library utilities as part of the notebook utilities page.&lt;/p&gt;
&lt;p&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/data-engineering/notebook-utilities#variable-library-utilities?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;https://learn.microsoft.com/en-us/fabric/data-engineering/notebook-utilities#variable-library-utilities&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Microsoft Fabric – Variable Library</title><link>https://hatfullofdata.blog/variable-library/</link><pubDate>Tue, 06 Jan 2026 13:27:41 +0000</pubDate><guid>https://hatfullofdata.blog/variable-library/</guid><description>&lt;img src="https://hatfullofdata.blog/variable-library/cover.png" alt="Featured image of post Microsoft Fabric – Variable Library" /&gt;&lt;p&gt;This post to help you get started creating a variable library. When multiple dataflows, notebooks and pipelines are using the same details to perform tasks it helps if those values are stored in one place. When you move to use deployment pipelines and those values change from your development workspace to your test workspace to your prod, it helps if that is easy. The solution in Microsoft Fabric is a Variable Library to store those common values.&lt;/p&gt;
&lt;h2&gt;Variable Library Series&lt;/h2&gt;
&lt;p&gt;Variable libraries should be part of every project. This post is part of my series to help get you started creating the library and then using the variables and finally seeing your hard work pay back when it comes to deployment pipelines.&lt;/p&gt;
&lt;ol&gt;
 &lt;li&gt;&lt;strong&gt;Getting started with variable libraries&lt;/strong&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/accessing-a-variable-library-in-a-notebook/"&gt;Variable Values in a Fabric Notebook&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-a-data-pipeline/"&gt;Variable Values in a Data Pipeline&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-a-variable-library-in-lakehouse-shortcuts/"&gt;Variable Values in Lakehouse Shortcuts&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href="https://hatfullofdata.blog/using-variable-library-in-a-dataflow/"&gt;Variable Values in Dataflows&lt;/a&gt;&lt;/li&gt;
 &lt;li&gt;&lt;a href=""&gt;Variable Libraries in Deployment Pipelines&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id="create-a-variable-library"&gt;Create a Variable Library
&lt;/h2&gt;&lt;p&gt;This post assumes the workspace is backed with a Fabric capacity. A trial capacity works just fine.&lt;/p&gt;
&lt;p&gt;Either from a Develop task add item or from the Add item button select Variable Library. Enter in a meaningful name for the variable library, letters, numbers and spaces are allowed. Then click the Create button and your new library will be opened. I recommend you create a naming convention that all your Fabric developers like and agree to use.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Creating a Variable library in the workspace" class="gallery-image" data-flex-basis="250px" data-flex-grow="104" height="980" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/variable-library/Variable-Library-001.png" srcset="https://hatfullofdata.blog/variable-library/Variable-Library-001_hu_6eefbd6f398d0d6b.png 800w, https://hatfullofdata.blog/variable-library/Variable-Library-001.png 1024w" width="1024"&gt;&lt;/p&gt;
&lt;h2 id="add-a-variable"&gt;Add a Variable
&lt;/h2&gt;&lt;p&gt;Your library starts empty, so the next task is to add variables. You can create a new variable row by clicking on + New Variable on the Home ribbon. When there are no variables there will also be a green button in the center of the page to create a new variable.&lt;/p&gt;
&lt;p&gt;&lt;img alt="Screen shots of the new variable buttons and the columns Name, Note, Type and Default Value." class="gallery-image" data-flex-basis="482px" data-flex-grow="201" height="338" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/variable-library/image-1.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;Enter in a meaningful name and select a data type. A name can only include letters, numbers and underscores. An incorrect name will prevent the library from being saved. Please note some types are not usable in some Fabric artifacts, no I haven’t worked out the logic yet but I’m working on it. Enter in a value for the Default value set. Value sets are used when you are using deployment pipelines for the different values you use development,test and production workspaces. Creating and using variable sets will be covered in another post.&lt;/p&gt;
&lt;h2 id="adding-notes"&gt;Adding Notes
&lt;/h2&gt;&lt;p&gt;So that “future you” doesn’t hate the “current you”, it is worth adding notes to variables to explain the purpose of the variable. This should be part of the best practice rules for Fabric development.&lt;/p&gt;
&lt;p&gt;&lt;img alt="screen grab showing the note button next to the variable name and the Add note to variable dialog box." class="gallery-image" data-flex-basis="290px" data-flex-grow="120" height="562" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://hatfullofdata.blog/variable-library/image-2.png" width="680"&gt;&lt;/p&gt;
&lt;p&gt;Click on the icon in the note column. When there is no note it has a plus symbol and when there is a note it has a pencil symbol.&lt;/p&gt;
&lt;h2 id="saving"&gt;Saving
&lt;/h2&gt;&lt;p&gt;Variable libraries do not auto-save. You need to click the save button on home ribbon. Indicators of black dots will show unsaved items you have open and the save button will only be active when there are changes to save.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;I highly recommend starting any Fabric project with creating a variable library. Then everytime a value is used in an artifact such as a database name, key vault name etc a descision is made on if it should be in the variable library or if the value is already there. Some values to be more useful will need to be split across multiple variables.&lt;/p&gt;
&lt;p&gt;It should always be assumed that a workspace with Fabric items will eventually be in a deployment pipeline. This means that it should be coded to make deployment easier. The aim of these articles is for quick reference on how variable libraries are used across all the artifacts.&lt;/p&gt;
&lt;h2 id="references"&gt;References
&lt;/h2&gt;&lt;p&gt;Microsoft have some getting started articles on setting up a variable library and using it in a deployment pipeline.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/fabric/cicd/variable-library/variable-library-overview?wt.mc_id=DX-MVP-5003563" target="_blank" rel="noopener"
 &gt;Microsoft Learn Variable Libraries&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>