Microsoft Fabric Samples

repository·main·Indexed 20 days ago

https://github.com/microsoft/fabric-samples

A repository of hands-on examples, code, and sample data for implementing Microsoft Fabric features. Key implementations include a Metadata-driven Data Ingestion Framework for moving data from sources like Azure PostgreSQL to Fabric Lakehouse, Datawarehouse, or Lakehouse Files using control tables and auditing. It also features PII SparkShield, a PySpark-based solution using Microsoft Presidio and Faker for detecting, redacting, and anonymizing Personally Identifiable Information (PII) within Microsoft Fabric.

Tokens
65.8K
Snippets
183
Records
245
Agent score
69%

What's inside microsoft-fabric-samples

  1. Overview of PII SparkShield

    main

    PII SparkShield is a PySpark-based solution designed for detecting and anonymizing Personally Identifiable Information (PII) within Microsoft Fabric. It leverages Microsoft Presidio for NLP-based detection, Faker for synthetic data generation, and PySpark for scalable processing.

    It supports three primary approaches:

    1. Detection & Redaction: Using Microsoft Presidio to identify PII in structured or unstructured data and replacing it with placeholders (e.g., REDACTED).
    2. Synthetic Data Generation: Using Presidio to find PII and Faker to replace it with realistic synthetic data.
    3. Built-in PySpark Functions: Using native Spark functions for hashing (e.g., sha2) and masking (e.g., partial hiding of phone numbers) for structured data.
  2. Overview of the Metadata-driven Data Ingestion Framework

    main

    The Metadata-driven Data Ingestion Framework is designed to build a strong foundation for a Microsoft Fabric Lakehouse by managing the collection, importing, and processing of raw data from various sources. It provides a structured way to manage both One-time Ingestion (initial historical data loads) and Incremental Ingestion (capturing only new data post-initial load).

    Core Components

    • Control Table: Manages the selection and ingestion of specific items from source systems.
    • Data Ingestion: Uses a Data Copy component to move data from source to the data lake (typically to a Bronze or Staging layer).
    • Auditing: Tracks ingested records, identifies errors, and reviews performance metrics.
    • Notification: Notifies operations teams of success or failure events.
    • Config Management: Manages framework configurations.
    • Reporting: Provides visibility into ingestion activities.
  3. Quickstart: Developing RAG Applications with Microsoft Fabric

    main

    This tutorial series provides a practical guide for building, evaluating, and optimizing Retrieval-Augmented Generation (RAG) applications using Microsoft Fabric. The guide is divided into three core tutorials:

    1. Building Retrieval Augmented Generation in Fabric: Learn to set up a RAG pipeline, connect data sources, use Fabric retrieval tools, and integrate with Azure OpenAI.
    2. Evaluating the performance of RAG Applications on Fabric: Learn to assess query accuracy, response quality, and system performance to drive data-driven improvements.
    3. Exploring Azure AI search in Fabric: Learn to use AI-powered search to enhance RAG applications by retrieving relevant information from large datasets.

    For the building phase, you can choose between using Fabric's built-in Azure OpenAI endpoints (no subscription keys required) or bringing your own Azure OpenAI subscription keys.

  4. Enrich Power BI reports with machine learning in Microsoft Fabric

    main
    This sample demonstrates an end-to-end pattern for integrating machine learning predictions into Power BI reports using Microsoft Fabric. The workflow involves using a governed semantic model as the source of truth, training a machine learning model (e.g., for churn prediction), and operationalizing those predictions through both batch and real-time scoring. This allows predictive insights to be surfaced directly in Power BI for monitoring and business action.
  5. Build an Adaptive Enterprise Knowledge Base tutorial

    main

    This tutorial guides you through building advanced GenAI-powered applications that extract knowledge from tribal conversational data (such as online forums). The primary use case is automatically generating FAQs or an adaptive knowledge base to optimize retrieval performance for RAG (Retrieval-Augmented Generation) systems.

    Key technical details:

    • LLM Endpoint: Azure OpenAI GPT4o
    • Platform: Microsoft Fabric
    • Data Source: Synthetic Microsoft Teams conversational data (structured like Microsoft Graph API).
    • Approach: Uses a set of human-defined themes to generate questions and discussion threads via an LLM to simulate real-world forum data.
  6. Explore Microsoft Fabric Samples

    main

    The microsoft/fabric-samples repository provides hands-on examples, code, and sample data to help you learn and implement Microsoft Fabric. The repository is organized into three main categories of samples:

    • Documentation Samples: Located in the docs-samples folder, these are the official examples used in Microsoft Fabric documentation and Microsoft Learn training content.
    • Features Samples: Located in the features-samples folder, these demonstrate how to use specific Microsoft Fabric features.
    • Community Samples: Located in the community-samples folder, these are real-world scenarios and creative implementations provided by the community.
  7. Understand the project structure

    main

    The project follows this directory layout:

    • src/index.tsx: Application entry point.
    • src/App.tsx: Main application component containing logic and UI.
    • src/App.css: Application styles.
    • src/components/: Directory for custom React components.
    • src/operations/: Directory for GraphQL queries and mutations.
    • src/Client.ts: Apollo Client configuration (endpoint, cache, and auth headers).
    • src/authConfig.ts: Authentication and endpoint configuration.
    • graphqlrc.yml: Configuration for GraphQL Intellisense and auto-completion.
    • codegen.yml: Configuration for GraphQL code generation.
  8. Use MCP tools: introspect-schema and query-graphql

    main

    The server provides two primary MCP tools to interact with your GraphQL API.

    Important Workflow: You must run introspect-schema before attempting to run queries. The client needs the schema to understand the available data structures.

    1. introspect-schema

    • Description: Retrieves the full GraphQL schema from the backend.
    • Parameters: None
    • Returns: The full GraphQL schema as JSON.

    2. query-graphql

    • Description: Executes an arbitrary GraphQL query against the backend.
    • Parameters:
      • query (string, required): The GraphQL query string.
      • variables (object, optional): GraphQL variables.
    • Returns: The query result as JSON.
  9. Architecture for ML-enriched Power BI reports

    main

    The end-to-end architecture for enriching Power BI reports with machine learning in Fabric follows these seven steps:

    1. Semantic model: Defines the core business logic and metrics.
    2. Semantic Link: Provides direct access to the semantic model from Fabric notebooks.
    3. Fabric ML experiment: Used to train and evaluate the machine learning model (e.g., a churn prediction model).
    4. Batch scoring: Applies the model at scale and saves the resulting predictions to OneLake.
    5. Real-time scoring endpoints: Supports low-latency inference for immediate predictions.
    6. Dataflow Gen2: Calls the real-time scoring endpoint to enrich data during the ingestion process.
    7. Power BI Report: Visualizes the churn risk and drives business actions.

    All components are natively integrated within Microsoft Fabric, sharing the same security, governance, and storage layers.

  10. Performance optimization techniques in PII SparkShield

    main

    The notebooks in this repository utilize two key Spark optimization techniques to handle large-scale PII processing:

    1. Pandas UDFs (Vectorized UDFs): Instead of standard Python UDFs which process data row-by-row, Pandas UDFs process data in batches using Pandas Series. This significantly reduces serialization overhead and leverages vectorized operations, making them much faster for large datasets.

    2. Broadcasting: For heavy objects like NLP models or Presidio engines, broadcasting is used to serialize the object only once and send it to each worker node once. This prevents Spark from serializing and sending a separate copy of the model to every single task, which reduces memory usage, network traffic, and job startup time.