Skip to content

Instantly share code, notes, and snippets.

View 7effrey89's full-sized avatar

Jeffrey Lai 7effrey89

  • Microsoft
  • Denmark
View GitHub Profile
@7effrey89
7effrey89 / fabric_livy_sample.py
Last active December 9, 2025 09:09
Demonstrate how to connect to the Livy Endpoint in Microsoft Fabric
"""
Documentation: https://learn.microsoft.com/en-us/fabric/data-engineering/get-started-api-livy
Fabric Livy API Sample Script
==============================
This script demonstrates how to use the Livy API to submit and execute
Spark session jobs in Microsoft Fabric.
Prerequisites:
- Fabric Premium or Trial capacity with a Lakehouse
@7effrey89
7effrey89 / app.py
Last active December 9, 2025 09:08
Fabric - Keyvault integration
KEYVAULT_NAME = "https://atpkvdemo.vault.azure.net"
SECRET_NAME = "adslgen2key"
# get access token for keyvault resource
# you can also use full audience here like https://vault.azure.net
accountKey = notebookutils.credentials.getSecret(KEYVAULT_NAME, SECRET_NAME)
#use secret with the storage account primary access key
notebookutils.fs.mount(
"abfss://[email protected]",
@7effrey89
7effrey89 / SalesLT.weathertable
Last active December 9, 2025 13:57
Unified Data Platform Demo - 1. Fabric-Compatible AdventureWorks that can be deployed on Azure SQL DB for Database Mirror demo; 2. .csv file for shortcut transformation
CountryRegion,Degree,Condition
United States,15,Sunny
Canada,-2,Snow
United Kingdom,8,Rainy
Denmark,4,Cloud
#https://learn.microsoft.com/en-us/rest/api/power-bi/admin/workspace-info-get-scan-result
#returns assets in a Fabric Workspace
import time
import json
import os
import requests
from azure.identity import DefaultAzureCredential
# ========= CONFIG =========
@7effrey89
7effrey89 / app.py
Created January 6, 2026 14:06
Powerbi - List users of semantic models and reports
# COMPLETE WORKSPACE USER CATALOG - Azure Default Credentials
# Gets all workspaces and their users, with rate limiting and filtering
# API endpoint supports 200 request per hour..
import time
import json
import requests
from azure.identity import DefaultAzureCredential
# ========= CONFIGURATION =========
@7effrey89
7effrey89 / test.ps1
Last active January 23, 2026 22:12
OneLake Security Rest API
[CmdletBinding()]
# Summary:
# Standalone validation utility that provisions a Fabric OneLake data access role
# (default: GoldReader) on the specified lakehouse and assigns a Microsoft Entra
# user to it using the documented preview endpoints. Useful for testing role
# creation/membership independently of the full workspace automation.
#how to run script:
#Onelake security must be enabled on the target lakehouse for this script to work.
#pwsh -NoLogo -NoProfile -Command "& 'c:/Git/Fabric_powershell/Standalone scripts/Test-OneLakeRoleAssignment.ps1' -WorkspaceName '001onelakesec' -LakehouseName 'Gold' -TenantId 'guid-guid-guid' -UserObjectId 'guid-guid-guid' -RoleName 'GoldReader'"