Skip to content

Commit e3a7e7c

Browse files
authored
Merge pull request #3 from MicrosoftCloudEssentials-LearningHub/ci/cd
CI + CD
2 parents f6a876f + af01774 commit e3a7e7c

File tree

7 files changed

+604
-0
lines changed

7 files changed

+604
-0
lines changed

Deployment-Pipelines/README.md

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# Deployment Pipelines - Demo \& Overview
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-04-15
9+
10+
------------------------------------------
11+
12+
> Lakehouse Schema and Deployment Pipelines
13+
14+
15+
<details>
16+
<summary><b> List of References </b> (Click to expand)</summary>
17+
18+
- [Table deletes, updates, and merges - DeltaTables](https://docs.delta.io/latest/delta-update.html#-merge-in-streaming)
19+
- [DeltaLake - DeltaTables Releases](https://github.com/delta-io/delta/releases)
20+
- [DeltaTable execute() example](https://github.com/delta-io/delta/blob/master/examples/python/quickstart.py#L50-L56)
21+
- [Create deployment rules](https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/create-rules?tabs=new)
22+
- [Notebook source control and deployment](https://learn.microsoft.com/en-us/fabric/data-engineering/notebook-source-control-deployment)
23+
- [Fabric: Understand the deployment process](https://learn.microsoft.com/en-us/fabric/cicd/deployment-pipelines/understand-the-deployment-process)
24+
- [Incremental refresh in Dataflow Gen2 - Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-incremental-refresh)
25+
- [Dataflow Gen2 refresh - Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/data-factory/dataflow-gen2-refresh)
26+
- [Announcing Public Preview: Incremental Refresh in Dataflow Gen2](https://blog.fabric.microsoft.com/en-us/blog/announcing-public-preview-incremental-refresh-in-dataflows-gen2/)
27+
- [Choose the best Fabric CI/CD workflow option for you](https://learn.microsoft.com/en-us/fabric/cicd/manage-deployment)
28+
29+
</details>
30+
31+
<details>
32+
<summary><b>Table of Contents</b> (Click to expand)</summary>
33+
34+
- [Overview](#overview)
35+
- [Demo](#demo)
36+
- [Create a Workspace](#create-a-workspace)
37+
- [Create a Lakehouse](#create-a-lakehouse)
38+
- [Create a New Semantic Model](#create-a-new-semantic-model)
39+
- [Auto-Generate Report with Copilot](#auto-generate-report-with-copilot)
40+
- [Create a Deployment Pipeline](#create-a-deployment-pipeline)
41+
- [Deploy to Production](#deploy-to-production)
42+
- [How to refresh the data](#how-to-refresh-the-data)
43+
44+
45+
</details>
46+
47+
## Overview
48+
49+
> [!Note]
50+
> `Ownership and Deployment`: In Microsoft Fabric, only the owner of an artifact can deploy it. Non-owner admins do not have the permissions to deploy artifacts. You can create a service principal to act like an owner, allowing it to deploy artifacts on behalf of the actual owner. This ensures that deployment tasks can be automated and managed efficiently without compromising security. <br/> <br/>
51+
> `Deployment Rules for Notebooks and Pipelines`: You can add `deployment rules` for notebooks and pipelines in Microsoft Fabric. Deployment rules `can be configured to manage different stages (development, test, production)` and to change content settings during deployment. For notebooks, you can set rules to specify the default lakehouse, which helps avoid manual changes to source and destination references post-deployment.
52+
53+
Process Overview:
54+
55+
1. **Pipeline Structure**: You define the deployment pipeline structure, which typically includes stages like development, test, and production. Each stage can have its own workspace.
56+
2. **Adding Content**: Content can be added to a pipeline stage by assigning a workspace or deploying content from one stage to another. When you deploy content, Microsoft Fabric copies the metadata, reports, dashboards, and semantic models to the target stage.
57+
3. **Content Cloning**: During deployment, the content from the source stage is cloned to the target stage. This includes the structure and semantic models but `not the actual data` within the tables. This means that while the structure and connections are maintained, the data itself needs to be refreshed or reloaded in the new stage.
58+
4. **Autobinding**: Microsoft Fabric tries to maintain connections between items during deployment. For example, if a report is connected to a semantic model, this connection is preserved in the target stage.
59+
60+
> [!IMPORTANT]
61+
> `Specifics for Lakehouse:` For lakehouses, the deployment process typically `includes the structure and metadata but not the actual data tables`. This is why you might see the structure and semantic models deployed, but the tables themselves need to be manually refreshed or reloaded in the target environment.<br/> <br/>
62+
> `Deployment Rules:` You can set deployment rules to manage different stages and change content settings during deployment. For example, you can specify default lakehouses for notebooks to avoid manual changes post-deployment.
63+
64+
## Demo
65+
66+
<div align="center">
67+
<img src="https://github.com/user-attachments/assets/46045fa8-34e8-4fff-a343-d49f36eece89" alt="Centered Image" style="border: 2px solid #4CAF50; border-radius: 2px; padding: 2px; width: 500px; height: auto;"/>
68+
</div>
69+
70+
### Create a Workspace
71+
72+
1. Navigate to the Microsoft Fabric portal.
73+
2. Click on `Create a new workspace`.
74+
75+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/58069226-12c5-43ca-9c0f-4f95d6d2a556" />
76+
77+
3. Name your workspace (e.g., `Analytics Dev`).
78+
79+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/97bf47a4-00d8-4acc-af85-2fc52793a8f5" />
80+
81+
4. Ensure that your workspace is allocated to the appropriate Fabric Capacity:
82+
83+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/0cf11e09-dbc1-470a-9a77-6dbc279a5242" />
84+
85+
5. You can repeat this same process to create the production environment. You may host your workspace in the same capacity or in a different Fabric Capacity. Name your workspace (e.g., `Analytics Prod`).
86+
87+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/1ba0f05c-1900-46e1-b4cc-3e0acb9fdd6a" />
88+
89+
| Dev Workspace | Prod Workspace |
90+
| --- | --- |
91+
| <img width="550" alt="image" src="https://github.com/user-attachments/assets/0cf11e09-dbc1-470a-9a77-6dbc279a5242" /> | <img width="550" alt="image" src="https://github.com/user-attachments/assets/927fc744-940d-4074-9576-1246f33c4f25" /> |
92+
93+
### Create a Lakehouse
94+
95+
1. Within your new workspace, select `New item` and choose `Lakehouse`.
96+
97+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/c391ccc3-408a-4a38-979c-acbe2fc65818" />
98+
99+
2. Name your lakehouse (e.g., `Sales_Data_Lakehouse`).
100+
101+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/a69d3f63-4286-4368-8515-d0383b63b09c" />
102+
103+
3. Click on `Get data`, and `Upload files`:
104+
105+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/e3dd716c-7391-4a03-9ff2-4f8722fd29bf" />
106+
107+
4. Load data into the tables:
108+
109+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/a28a5540-106e-4fa2-b515-88831fa96b8d" />
110+
111+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/b543a1c8-6686-484e-a9a9-f372c53262f0" />
112+
113+
5. The information loaded will be under Tables/dbo section, if you are using the lakehouse schema:
114+
115+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/0b3da49f-2738-412a-8b9d-bb0f2433d181" />
116+
117+
### Create a New Semantic Model
118+
119+
1. Use the `New semantic model` option to create a Power BI semantic model.
120+
2. Select specific tables and views from your lakehouse.
121+
3. Save the semantic model to your workspace for sharing, data modeling, and reporting.
122+
123+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/25bda38f-41fa-45f9-aa01-e647d9f4bd84" />
124+
125+
4. At this point, you should see something similar like following: 
126+
127+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/e1f88782-ddc6-4fb8-947a-af23b92a8415" />
128+
129+
130+
### Auto-Generate Report with Copilot
131+
132+
> [!NOTE]
133+
> Ensure you have the necessary permissions and settings enabled for Copilot to access and use your data.
134+
135+
1. Use Copilot to create a report based on your dataset. In your workspace, click on `...` over your semantic model and select `Auto-create report`:
136+
137+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/19718d27-7385-45a8-8aeb-2a6409490c61">
138+
139+
2. The outcome will depend on the information you provide in this case. Copilot automatically generated this report for me; you can continue editing:
140+
141+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/9f4bdd42-8ac5-43ea-9af9-32828b59b4a7" />
142+
143+
3. Remember to click on `Save`:
144+
145+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/097a90e0-e131-4205-ad9c-241e34b0206b" />
146+
147+
### Create a Deployment Pipeline
148+
149+
1. Go back to the Microsoft Fabric portal and select `Deployment Pipelines`.
150+
151+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/507fe86a-8710-407e-ae31-5597371b9945" />
152+
153+
2. Create a new pipeline and name it (e.g., `Dev to Prod Pipeline`).
154+
155+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/52681609-c66d-445c-a387-ff1989f0bf53" />
156+
157+
3. You can customize your stages. For this case, we will only have a development workspace and a production workspace:
158+
159+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/1836520a-7b70-4a12-a8af-5a78e29c95ab" />
160+
161+
4. Add your `Analytics Dev` workspace as the source, click on `Assign a workspace`:
162+
163+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/df0291f4-84a0-46f3-83aa-3dc6aa99ef07" />
164+
165+
5. Add the `Production Workspace` as the target.
166+
167+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/082614ba-4d9a-4a2a-a0c2-a3287366ee75" />
168+
169+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/bf39af09-2fda-4d49-958b-d68b87a300c6" />
170+
171+
### Deploy to Production
172+
173+
1. Use the deployment pipeline to move your lakehouse, dataset, and report from the `Analytics Dev` to the `Analytics Prod` workspace.
174+
175+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/0492b8a4-3d7c-4d27-9bfc-a4996e6f3c3e" />
176+
177+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/f99211f2-a60c-414d-a1a0-9135c2fd5879" />
178+
179+
2. Verify that everything is working correctly in the production environment.
180+
181+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/46045fa8-34e8-4fff-a343-d49f36eece89" />
182+
183+
<img width="550" alt="image" src="https://github.com/user-attachments/assets/fc139a2c-3f59-4534-8378-55fe929d33b2" />
184+
185+
## How to refresh the data
186+
187+
> To ensure that data is refreshed and reloaded in the new stage of your deployment in Microsoft Fabric, you can use the following methods:
188+
189+
| **Type of Refresh** | **Description** | **Details** |
190+
|---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
191+
| **Scheduled Refresh** | Automatically refreshes data at specified intervals to keep it up-to-date. This allows you to automatically refresh the data at specified intervals, ensuring that the data in the new stage is always up-to-date. | - Can be configured to run multiple times a day.<br>- Ensures data in the new stage is always current. |
192+
| **On-Demand Refresh** | Allows immediate data refresh, triggered manually or programmatically. | - Can be done through workspace list or lineage views.<br>- Can be triggered via a pipeline containing a dataflow activity. |
193+
| **Incremental Refresh** | Refreshes only the data that has changed since the last refresh, improving efficiency. Click [here to understand more about incremental refresh](https://github.com/brown9804/MicrosoftCloudEssentialsHub/blob/main/0_Azure/2_AzureAnalytics/0_Fabric/demos/11_PBi_IncreRefresh.md) | - **Evaluate Changes**: Checks for changes in the data source based on a DateTime column.<br>- **Retrieve Data**: Only changed data is retrieved and loaded.<br>- **Replace Data**: Updated data is processed and replaced. |
194+
195+
Steps to Set Up Incremental Refresh:
196+
1. **Create or Open a Dataflow**: Start by creating a new Dataflow Gen2 or opening an existing one.
197+
2. **Configure the Query**: Ensure your query includes a DateTime column that can be used to filter the data.
198+
3. **Enable Incremental Refresh**: Right-click the query and select Incremental Refresh. Configure the settings, such as the DateTime column and the time range for data extraction.
199+
4. **Publish the Dataflow**: Once configured, publish the dataflow. The dataflow will then automatically refresh the data incrementally based on the settings.
200+
201+
<div align="center">
202+
<h3 style="color: #4CAF50;">Total Visitors</h3>
203+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
204+
</div>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Demo Samples
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](https://github.com/)
6+
[brown9804](https://github.com/brown9804)
7+
8+
Last updated: 2025-04-15
9+
10+
------------------------------------------
11+
12+
> In this folder, you'll find some sample files that we'll be using throughout the demo.
13+
> `These files will help us illustrate the process of creating a workspace, setting up a lakehouse, defining a dataset schema, generating reports with Copilot, creating a semantic model, and deploying through a pipeline`.
14+
15+
<div align="center">
16+
<h3 style="color: #4CAF50;">Total Visitors</h3>
17+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
18+
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Receipt ID,Date,Store,Amount
2+
R0001,2024-05-17,Store B,167.99
3+
R0002,2024-09-12,Store B,497.68
4+
R0003,2024-06-25,Store D,319.52
5+
R0004,2024-07-09,Store D,177.2
6+
R0005,2024-08-29,Store A,360.12
7+
R0006,2023-12-27,Store B,462.89
8+
R0007,2024-08-15,Store D,483.69
9+
R0008,2024-09-04,Store C,332.03
10+
R0009,2024-08-22,Store D,157.99
11+
R0010,2024-06-21,Store A,180.66

0 commit comments

Comments
 (0)