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 / 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'"
@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 =========
#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 / 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
@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://mycontainer@amlwsatp0010067670284.blob.core.windows.net",
@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 / notebook.ipynb
Created October 21, 2025 13:16
Fabric - AI function demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@7effrey89
7effrey89 / Variance Analysis.ipynb
Last active October 21, 2025 12:57
Fabric - Loop through each row in table and search column values against Azure AI Search, then use AI Functions to summarize output in new column
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@7effrey89
7effrey89 / notebook.py
Last active October 23, 2025 08:55
Fabric - Process all .csv in Lakehouse folder to delta tables. The .csv files are placed in a subfolder called 'input'
import os
import re
files_folder = "/lakehouse/default/Files/input"
csv_files = []
for root, dirs, files in os.walk(files_folder):
for file in files:
if file.endswith('.csv'):
csv_files.append(os.path.join(root, file))
@7effrey89
7effrey89 / Notebook.ipynb
Created September 29, 2025 15:44
Display an overview of Semantic models and their size in Microsoft Fabric
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.