AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The hdinsight-migration skill provides a structured framework for transitioning legacy HDInsight Spark and Hive workloads to the Microsoft Fabric ecosystem. It outlines the necessary architectural shifts, such as replacing legacy SparkContext and HiveContext with pre-instantiated SparkSession, migrating storage paths from WASB/ABFS to OneLake shortcuts, and converting Oozie workflows into Fabric Data Pipelines. The skill emphasizes modernizing data storage to Delta Lake and utilizing notebookutils for enhanced operational capabilities, ensuring a smooth transition from cluster-based management to Fabric's serverless compute model.
What it does
- Maps HDInsight components to their corresponding Microsoft Fabric services.
- Provides patterns for replacing legacy Spark 1.x/2.x APIs with Spark 3.x SparkSession.
- Guides the conversion of Hive DDL to Delta Lake tables within Lakehouses.
- Translates Oozie workflow actions into Fabric Data Pipeline activities.
- Replaces deprecated WASB/ABFS storage paths with OneLake shortcuts.
- Introduces notebookutils for file system operations and secret management.
When to use it
- When planning or executing the migration of existing HDInsight Spark or Hive workloads to Microsoft Fabric.
- When refactoring legacy Oozie workflows into modern Fabric Data Pipelines.
- When updating Spark code to comply with Fabric's Spark 3.x runtime and pre-instantiated session environment.
- When restructuring data storage from HDFS or WASB to OneLake.
Advantages
- Reduces migration friction by providing clear mapping between legacy and modern components.
- Ensures compatibility with Fabric's serverless compute and managed infrastructure.
- Promotes the use of Delta Lake for improved data quality and performance.
- Standardizes operational tasks using the built-in notebookutils library.
Usage examples
- “How do I replace my legacy HiveContext code in a migrated Spark notebook?”
- The agent will instruct you to remove the HiveContext instantiation and use the pre-instantiated 'spark' session, which natively supports Hive-compatible SQL via Delta schemas.
- “What is the Fabric equivalent for an Oozie Spark action?”
- The agent will explain how to map the Oozie Spark action to a Fabric Notebook activity or a Spark Job Definition activity, including how to pass parameters.
- “How should I handle WASB paths during my migration to Fabric?”
- The agent will guide you to replace WASB paths with OneLake shortcuts (abfss://) to leverage Fabric's native data access and authentication models.
Install
Download the skill as a ZIP:
https://mp-staging.autogineer.com/agent-skills/microsoft/hdinsight-migration/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip hdinsight-migration.zip -d .agents/skills
Documentation by Microsoft
Telemetry — MANDATORY. Every
api.fabric.microsoft.comcall must carryx-ms-fabric-skill: hdinsight-migration(az rest:--headers "x-ms-fabric-skill=hdinsight-migration"), including every LRO poll,fabric_lroand retry. Snippets omit it — add it anyway.
CRITICAL NOTES
To find workspace details (including its ID) from a workspace name: list all workspaces, then use JMESPath filtering
To find item details (including its ID) from workspace ID, item type, and item name: list all items of that type in that workspace, then use JMESPath filtering
HDInsight has no
mssparkutilsordbutilsequivalent —notebookutilsis net-new capability being introduced
HiveContextandSQLContextare legacy Spark 1.x/2.x APIs — Fabric uses Spark 3.xSparkSessionexclusively
wasb://paths are deprecated and require a Storage Account key or SAS — replace with OneLake shortcutsFabric cannot read or shortcut
hdfs://directly. Its Pipeline HDFS connector supports Anonymous authentication only; export or bridge Kerberos sources to supported storage first.
HDInsight → Microsoft Fabric Migration
Prerequisite Knowledge
Read these companion documents before executing migration tasks:
COMMON-CORE.md — Fabric REST API patterns, authentication, token audiences, item discovery
COMMON-CLI.md —
az rest,az login, token acquisition, Fabric REST via CLISPARK-AUTHORING-CORE.md — Notebook deployment, lakehouse creation, Spark job execution
For notebook and Lakehouse creation, see spark-cli. For Fabric Warehouse DDL/DML authoring, see sqldw-cli.
Table of Contents
| Topic | Reference |
|---|---|
| Migration Workload Map | § Migration Workload Map |
| SparkSession & Context API Changes | § SparkSession API Changes |
| WASB / ABFS → OneLake Path Migration | path-migration.md |
| Hive DDL → Delta Lake / Lakehouse Schemas | hive-to-delta.md |
| Oozie → Fabric Pipelines | § Oozie → Fabric Pipelines |
Introducing notebookutils | § Introducing notebookutils |
| Before/After Code Patterns | code-patterns.md |
| Spark Configuration Differences | § Spark Configuration Differences |
| Must / Prefer / Avoid | § Must / Prefer / Avoid |
| Authentication & Token Acquisition | COMMON-CORE.md § Authentication |
| Lakehouse Management | SPARK-AUTHORING-CORE.md § Lakehouse Management |
Migration Workload Map
| HDInsight Component | Fabric Target | Notes |
|---|---|---|
| Spark cluster (notebooks, scripts) | Fabric Spark (Lakehouse / Notebooks / SJD) | No persistent cluster — Starter Pool or Custom Pool provides on-demand Spark |
| Hive / HiveServer2 | Lakehouse SQL Endpoint + Lakehouse schemas | Delta Lake replaces Hive metastore; schemas provide namespace equivalent |
| HBase | Fabric Warehouse or Azure Cosmos DB (separate from Fabric) | HBase has no direct Fabric equivalent — assess workload access patterns |
| Oozie workflows | Fabric Data Pipelines | Map Oozie actions to Fabric activities; see § Oozie → Fabric Pipelines |
| YARN Resource Manager | Fabric Spark monitoring (Spark UI, Monitoring Hub) | No YARN — Fabric manages compute automatically |
| Ambari | Fabric Monitoring Hub + Admin Portal | Cluster health, capacity, and job monitoring |
| WASB / ABFS storage | OneLake Shortcuts → abfss://[email protected]/ | See path-migration.md |
| Ranger policies | Fabric workspace roles + OneLake data access roles | Map Ranger row/column filters to Lakehouse row-level security |
| Livy REST server | Fabric Livy API | Compatible endpoint — see SPARK-AUTHORING-CORE.md |
SparkSession & Context API Changes
HDInsight Spark clusters often use legacy Spark 1.x / 2.x API styles. Replace all of these with the unified SparkSession:
| Legacy HDInsight Pattern | Fabric Spark 3.x Replacement |
|---|---|
from pyspark import SparkContext; sc = SparkContext() | Not needed — sc = spark.sparkContext (pre-instantiated) |
from pyspark.sql import HiveContext; hc = HiveContext(sc) | Not needed — spark session has Hive-compatible SQL support via Delta schemas |
from pyspark.sql import SQLContext; sqlc = SQLContext(sc) | Not needed — use spark.sql(...) directly |
SparkSession.builder.enableHiveSupport().getOrCreate() | Not needed in Fabric — spark is pre-built and available |
sc.textFile("wasb://[email protected]/path") | spark.read.text("abfss://[email protected]/lh.Lakehouse/Files/path") |
sqlContext.sql("CREATE TABLE ... STORED AS ORC") | See hive-to-delta.md for Delta DDL equivalent |
In Fabric notebooks,
spark(SparkSession) andsc(SparkContext) are pre-instantiated — do not callSparkContext()orSparkSession.builder...getOrCreate()at the top of migrated notebooks.
Oozie → Fabric Pipelines
Map Oozie workflow actions to Fabric Data Pipeline activities:
| Oozie Action Type | Fabric Pipeline Activity | Notes |
|---|---|---|
<spark> action | Notebook activity or Spark Job Definition activity | Pass parameters via notebook cell parameters or SJD arguments |
<hive> action | Script activity (SQL) against Lakehouse SQL Endpoint | Convert HiveQL to Spark SQL or Delta SQL |
<shell> action | Azure Function activity or Web activity | Shell scripts must be refactored; no direct shell execution in Fabric Pipelines |
<java> action | Azure Batch activity (external) or refactor to PySpark | Java MapReduce jobs must be rewritten |
<sqoop> action | Copy Data activity (Fabric Data Factory connector) | Sqoop import/export maps to Fabric Copy Data with JDBC source/sink |
<coordinator> (time-based schedule) | Pipeline schedule trigger | Set recurrence in pipeline trigger; supports cron-like expressions |
<coordinator> (data-triggered) | Storage Event trigger | Trigger on OneLake file arrival |
Delegate to
spark-clifor notebook and SJD creation after mapping pipeline activities.
Introducing notebookutils
HDInsight Spark had no built-in utility framework equivalent to mssparkutils or dbutils. When migrating to Fabric, introduce notebookutils for common operations:
| Operation | Old HDInsight Approach | notebookutils Equivalent |
|---|---|---|
| List files | dbutils (N/A) / HDFS CLI | notebookutils.fs.ls("abfss://...") |
| Copy file | HDFS API / shutil | notebookutils.fs.cp(src, dest) |
| Read secret | Azure Key Vault REST call | notebookutils.credentials.getSecret(keyVaultUrl, secretName) |
| Get notebook context | Not available | notebookutils.runtime.context — returns workspace ID, notebook ID, etc. |
| Run child notebook | Not available | notebookutils.notebook.run("notebook_name", timeout, {"param": "value"}) |
| Exit notebook with value | sys.exit() | notebookutils.notebook.exit("value") |
| Mount storage | WASB config in spark-defaults.conf | OneLake Shortcut (no runtime mount needed) |
Spark Configuration Differences
| HDInsight Concept | Fabric Spark Equivalent | Migration Action |
|---|---|---|
spark-defaults.conf (cluster-wide) | Fabric Spark Workspace Settings + Environment item | Move config properties to Environment or use %%configure in notebooks |
%%configure magic | %%configure magic — identical | No change needed |
| YARN queue / resource allocation | Fabric Spark pool node size and autoscale settings | Map queue SLAs to Custom Pool configuration |
| Ambari service configs (HDFS, YARN tuning) | Not applicable — Fabric manages infrastructure | Remove; focus on application-level Spark configs |
| HDI Spark version (e.g., Spark 2.4) | Fabric Runtime 1.3 = Spark 3.5 (latest) | Test for deprecated API removals (e.g., HiveContext, RDD-style ML) |
Conda environment / bootstrap.sh | Fabric Environment item with custom libraries | Recreate conda/pip dependencies in a Fabric Environment |
hive-site.xml (metastore connection) | Not needed — Delta Lake IS the metastore in Fabric | Remove metastore config; use Lakehouse schemas for namespace organization |
Must / Prefer / Avoid
MUST DO
Replace all
wasb:///wasbs://paths with OneLakeabfss://paths or OneLake Shortcuts —wasb://requires storage account keys which are not the Fabric-preferred auth modelReplace
HiveContext,SQLContext, and standaloneSparkContext()— use the pre-instantiatedsparksession in Fabric notebooksMigrate Hive DDL (
STORED AS ORC,LOCATION,TBLPROPERTIES) to Delta Lake DDL — see hive-to-delta.mdIntroduce
notebookutilsfor file system operations, secret retrieval, and child notebook orchestration where HDInsight used custom scripts or direct API callsReplace Oozie XML workflows with Fabric Data Pipelines — see § Oozie → Fabric Pipelines
Align library management to Fabric Environments — remove
bootstrap.sh, conda envs, and runtime%pip installpatterns for production workloadsTreat
hdfs://as source-cluster-only — export or ingest into ADLS Gen2 or OneLake; do not claim that a gateway adds Kerberos support to Fabric's Anonymous-only HDFS connector
PREFER
OneLake Shortcuts over copying data — mount existing ADLS Gen2 containers as shortcuts to avoid re-ingestion during migration
Delta Lake for all tables migrated from Hive ORC/Parquet — ACID guarantees, time travel, and schema enforcement improve data quality
Fabric Starter Pool for initial migration validation — no pool configuration overhead, fast session startup
Lakehouse schemas (database namespaces) for organizing migrated Hive databases — one schema per Hive database within a single Lakehouse
Medallion architecture for restructuring migrated data layers during migration — align Bronze/Silver/Gold with raw Hive → validated Delta → serving Gold patterns
AVOID
Do not use
SparkContext()orHiveContext()constructors in Fabric notebooks — they conflict with the pre-instantiatedsparksession and will raise errorsDo not use
hive-site.xmlor external Hive metastore configuration — Fabric's Delta Lake-backed Lakehouse IS the metastoreDo not assume YARN queue mappings translate to Fabric pools — re-design resource allocation based on Fabric Spark pool SLAs
Do not attempt to run Oozie shell actions or Java MapReduce jobs directly in Fabric — these must be refactored (see § Oozie → Fabric Pipelines)
Do not use
%shmagic for file system operations in production notebooks — usenotebookutils.fs.*for portability and OneLake token-based auth
Examples
See code-patterns.md for full before/after examples. Key quick references:
Legacy context → Fabric pre-instantiated session
# HDInsight (remove entirely)
from pyspark.sql import HiveContext
hc = HiveContext(sc)
# Fabric — use pre-instantiated spark directly
df = spark.sql("SELECT * FROM sales.fact_orders")WASB path → OneLake path (after shortcut creation)
# HDInsight
df = spark.read.parquet("wasb://[email protected]/orders/")
# Fabric
df = spark.read.parquet("Files/raw/orders/")Hive DDL → Delta DDL
-- HDInsight
CREATE TABLE sales_db.fact_orders (...) STORED AS ORC LOCATION 'wasb://...';
-- Fabric
CREATE SCHEMA IF NOT EXISTS sales_db;
CREATE TABLE sales_db.fact_orders (...) USING DELTA;Files
- ATTRIBUTION.mdAdded by AutoGineer883 B
- LICENSELicence file added by AutoGineer1.1 KiB
- SKILL.md12.5 KiB
- apm.yml459 B
- resources/code-patterns.md5.4 KiB
- resources/hive-to-delta.md6.5 KiB
- resources/path-migration.md6.7 KiB
resources/hive-to-delta.md
Hive DDL → Delta Lake / Fabric Lakehouse Schema Migration
Reference for converting Hive DDL and metastore constructs to Microsoft Fabric Lakehouse patterns.
Conceptual Mapping
| Hive Concept | Fabric Equivalent | Notes |
|---|---|---|
| Hive Metastore | Fabric Lakehouse (per lakehouse schema) | Each Lakehouse is a Delta-backed metastore namespace |
| Hive Database | Lakehouse Schema (namespace within a Lakehouse) | Create schemas with CREATE SCHEMA in Spark SQL |
Hive Table (STORED AS ORC/Parquet) | Delta Table in Lakehouse Tables/ | Rewrite DDL to use Delta format |
| External Hive Table (LOCATION) | OneLake Shortcut + schema reference | Create shortcut to existing storage, then read directly |
| Hive View | Fabric Lakehouse View (via Spark SQL CREATE VIEW) | Views are supported in Lakehouse schemas |
Hive Partitioning (PARTITIONED BY) | Delta partitioning (partitionBy) | Same concept; Delta syntax |
MSCK REPAIR TABLE | MSCK REPAIR TABLE — supported | Or use Delta GENERATE SYMLINK_FORMAT_MANIFEST |
DDL Conversion Examples
Create Table
-- BEFORE — Hive DDL
CREATE TABLE IF NOT EXISTS sales_db.fact_orders (
order_id BIGINT,
customer_id INT,
order_date DATE,
amount DECIMAL(18,2)
)
STORED AS ORC
LOCATION 'wasb://[email protected]/fact_orders/'
TBLPROPERTIES ('orc.compress'='SNAPPY');
-- AFTER — Fabric Spark SQL (Delta)
-- Step 1: Create schema (maps to Hive database)
CREATE SCHEMA IF NOT EXISTS sales_db;
-- Step 2: Create Delta table in schema
CREATE TABLE IF NOT EXISTS sales_db.fact_orders (
order_id BIGINT,
customer_id INT,
order_date DATE,
amount DECIMAL(18,2)
) USING DELTA;For an external Hive table backed by ORC or Parquet files, use the OneLake
shortcut as the migration source, read the source format, and write a new Delta
table. Do not declare USING DELTA LOCATION 'Files/...' over ORC or Parquet
files; a Delta LOCATION is valid only when the target folder already contains
Delta data and its transaction log.
source_df = spark.read.format("orc").load("Files/hive-export/fact_orders/")
source_df.write.format("delta").mode("overwrite").saveAsTable("sales_db.fact_orders")Partitioned Table
-- BEFORE — Hive: partitioned Parquet table
CREATE TABLE logs_db.app_logs (
log_id BIGINT,
message STRING,
severity STRING
)
PARTITIONED BY (log_date DATE, app_name STRING)
STORED AS PARQUET;
-- AFTER — Fabric: Delta with partitioning
CREATE SCHEMA IF NOT EXISTS logs_db;
CREATE TABLE logs_db.app_logs (
log_id BIGINT,
message STRING,
severity STRING,
log_date DATE,
app_name STRING
) USING DELTA
PARTITIONED BY (log_date, app_name);PySpark DataFrame Write (replaces HiveContext insertInto)
# BEFORE — HDInsight: write to Hive table
df.write.mode("overwrite").insertInto("sales_db.fact_orders")
# OR: saveAsTable in Hive metastore
df.write.mode("overwrite").format("orc").saveAsTable("sales_db.fact_orders")
# AFTER — Fabric: write as Delta to Lakehouse
df.write.format("delta").mode("overwrite").saveAsTable("sales_db.fact_orders")
# Or with explicit partitioning
df.write.format("delta") \
.mode("overwrite") \
.partitionBy("log_date", "app_name") \
.saveAsTable("logs_db.app_logs")Hive UDFs → Fabric Spark UDFs
# BEFORE — Hive UDF registration (via HiveContext)
hc.sql("CREATE TEMPORARY FUNCTION my_udf AS 'com.example.MyUDF'")
# AFTER — Fabric: register Python UDF with SparkSession
from pyspark.sql.functions import udf
from pyspark.sql.types import StringType
@udf(returnType=StringType())
def my_udf(value):
return value.strip().upper()
spark.udf.register("my_udf", my_udf)
df.withColumn("result", my_udf(df["input_col"]))Java/Scala UDFs must be rewritten in Python or Scala and compiled as a JAR, then included in the Fabric Environment.
HiveQL → Spark SQL Compatibility
Most HiveQL is compatible with Spark SQL. Key differences:
| HiveQL Feature | Spark SQL Behavior | Action |
|---|---|---|
STORED AS ORC / STORED AS PARQUET | Ignored or error in Delta DDL | Replace with USING DELTA |
LOCATION 'hdfs://...' | Replace HDFS path with OneLake path or remove for managed tables | Update or remove |
TBLPROPERTIES (...) | Supported for Delta properties | Keep Delta-relevant properties; remove ORC/Hive-specific ones |
MSCK REPAIR TABLE | Supported | Keep as-is |
SHOW PARTITIONS | Supported | Keep as-is |
LATERAL VIEW EXPLODE | Supported | Keep as-is |
DISTRIBUTE BY / SORT BY | Supported (hint) | Keep as-is |
TRANSFORM ... USING script.py | Not supported — Hive streaming transform | Rewrite as PySpark UDF or mapPartitions |
LOAD DATA INPATH | Not supported for Delta | Use COPY INTO (Warehouse) or Spark read+write pattern |
Migrating a Hive Database to a Lakehouse Schema
Step-by-step migration of a Hive database to a Fabric Lakehouse schema:
# Step 1: Create a schema in the Lakehouse (maps to Hive database)
spark.sql("CREATE SCHEMA IF NOT EXISTS sales_db")
# Step 2: For each Hive table, read its source format from the ADLS shortcut and write as Delta
hive_tables = {
"fact_orders": "orc",
"dim_customer": "parquet",
"dim_product": "parquet",
}
for table, source_format in hive_tables.items():
# Read from ADLS (via OneLake shortcut)
df = spark.read.format(source_format).load(f"Files/hive-export/{table}/")
# Write as Delta to Lakehouse schema
df.write.format("delta").mode("overwrite").saveAsTable(f"sales_db.{table}")
print(f"Migrated {table}")
# Step 3: Verify
spark.sql("SHOW TABLES IN sales_db").show()Schema Organization: Hive Databases → Lakehouse Schemas
Fabric Lakehouses support multiple schemas (namespaces). Use this pattern to organize migrated Hive databases:
| Hive Structure | Fabric Structure |
|---|---|
raw_db Hive database | BronzeLakehouse with raw schema |
processed_db Hive database | SilverLakehouse with processed schema |
analytics_db Hive database | GoldLakehouse with analytics schema |
| Multiple subject area databases | Multiple schemas within a single Lakehouse, or separate Lakehouses per domain |
-- Create subject-area schemas within a Lakehouse
CREATE SCHEMA IF NOT EXISTS finance;
CREATE SCHEMA IF NOT EXISTS hr;
CREATE SCHEMA IF NOT EXISTS operations;
-- Tables are then organized as:
-- finance.fact_transactions
-- hr.dim_employee
-- operations.fact_eventsRequirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python, Needs Node.js
Security
What our scanner noticed· Low risk
- Instructions that use the network
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Microsoft
- Publisher
- Microsoft (Official)
- Source
- microsoft/skills-for-fabric · skills/hdinsight-migration · commit f8fac11
- Licence
- MIT License (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
- Also distributed in
- microsoft/skills-for-fabric
AutoGineer is not affiliated with or endorsed by Microsoft.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download hdinsight-migration.zip