Forum Discussion
Automating Workflow and Configuration with Fabric CLI or Other Code Alternatives
Hello,
I have recently started exploring the recently released Fabric CLI with the goal of automating my workspace setup. So far, I have found the CLI to be quite easy to use and intuitive, which is great, bu I noticed that when it comes to configuring certain components the options seem limited or undocumented.
I am trying to automate the creation of multiple Workspaces, each with their own Kusto DB in a Lakehouse, and I want to use EventStreams to connect them to several IoT Hubs to collect their data in the databases using an ingestion mapping. I haven’t found anything clear on whether it's possible to configure EventStreams (and their mappings or IoT Hub bindings) through the CLI or in combination with other tools.
I know that the Fabric platform is described as low-code to no-code, but for a larger workflow I would like to be able to automate all the steps, so is there a recommended way to handle this kind of setup using code? Can the Fabric CLI be extended or integrated with another interface to support item creation with detailed a configuration?
I would happily accept other suggestions if someone tried to automate this flow, either using a single tool or a combination, anything helps.
Thank you!
Hi MMacarie,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Although you can use the CLI to automate the creation of Workspaces, Lakehouse, and Warehouses, there are currently no CLI commands for creating or configuring EventStream or setting up ingestion mappings for Real-Time Analytics. You can review the latest CLI features and limitations in the official documentation:
Microsoft Fabric CLI | fabric-cli
Fabric command line interface - Microsoft Fabric REST APIs | Microsoft Learn
If you want to connect IoT Hubs to EventStream and route data to a Kusto Database or Lakehouse,use Fabric REST API, which supports EventStream configuration.
Eventstream REST API - Microsoft Fabric | Microsoft LearnThank you.
Hi MMacarie ,
v-saisrao-msft is spot on about the CLI limitations. The Fabric CLI is still pretty new and EventStream automation is one of those gaps that's frustrating when you're trying to build end-to-end workflows.
Here's what I'd recommend for your automation strategy:
Phase 1 - Use CLI for what it does well:
bash# Workspace and basic infrastructure fabric workspace create --name "IoTWorkspace01" fabric lakehouse create --workspace "IoTWorkspace01" --name "IoTLakehouse" fabric kql-database create --workspace "IoTWorkspace01" --name "IoTKustoDB"
Phase 2 - REST APIs for EventStream complexity: You'll need to switch to REST API calls for the EventStream parts. The EventStream REST API documentation @v-saisrao-msft linked is your friend here, but it's going to require more code.
Practical hybrid approach: Build a PowerShell or Python script that combines both:
- CLI commands for the easy stuff (workspaces, lakehouses, KQL DBs)
- REST API calls for EventStream creation and IoT Hub bindings
- Use the same service principal authentication for both
Reality check: EventStream automation through code is still pretty clunky compared to the low-code experience in the portal. You might end up doing EventStream configuration manually for now and automating everything else.
Pro tip: If you're creating multiple similar workspaces, consider creating one "template" workspace manually with all the EventStream configurations, then use the REST APIs to clone/replicate the EventStream settings to your new workspaces.
The Fabric team is actively expanding CLI capabilities, so this gap should get filled eventually. But for now, the hybrid approach is your best bet.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes.
3 Replies
- burakkaragoz
Super User
Hi MMacarie ,
v-saisrao-msft is spot on about the CLI limitations. The Fabric CLI is still pretty new and EventStream automation is one of those gaps that's frustrating when you're trying to build end-to-end workflows.
Here's what I'd recommend for your automation strategy:
Phase 1 - Use CLI for what it does well:
bash# Workspace and basic infrastructure fabric workspace create --name "IoTWorkspace01" fabric lakehouse create --workspace "IoTWorkspace01" --name "IoTLakehouse" fabric kql-database create --workspace "IoTWorkspace01" --name "IoTKustoDB"
Phase 2 - REST APIs for EventStream complexity: You'll need to switch to REST API calls for the EventStream parts. The EventStream REST API documentation @v-saisrao-msft linked is your friend here, but it's going to require more code.
Practical hybrid approach: Build a PowerShell or Python script that combines both:
- CLI commands for the easy stuff (workspaces, lakehouses, KQL DBs)
- REST API calls for EventStream creation and IoT Hub bindings
- Use the same service principal authentication for both
Reality check: EventStream automation through code is still pretty clunky compared to the low-code experience in the portal. You might end up doing EventStream configuration manually for now and automating everything else.
Pro tip: If you're creating multiple similar workspaces, consider creating one "template" workspace manually with all the EventStream configurations, then use the REST APIs to clone/replicate the EventStream settings to your new workspaces.
The Fabric team is actively expanding CLI capabilities, so this gap should get filled eventually. But for now, the hybrid approach is your best bet.
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
This response was assisted by AI for translation and formatting purposes. - v-saisrao-msft
Community Support
Hi MMacarie,
Thank you for reaching out to the Microsoft Fabric Forum Community.
Although you can use the CLI to automate the creation of Workspaces, Lakehouse, and Warehouses, there are currently no CLI commands for creating or configuring EventStream or setting up ingestion mappings for Real-Time Analytics. You can review the latest CLI features and limitations in the official documentation:
Microsoft Fabric CLI | fabric-cli
Fabric command line interface - Microsoft Fabric REST APIs | Microsoft Learn
If you want to connect IoT Hubs to EventStream and route data to a Kusto Database or Lakehouse,use Fabric REST API, which supports EventStream configuration.
Eventstream REST API - Microsoft Fabric | Microsoft LearnThank you.
- v-saisrao-msft
Community Support
Hi MMacarie,
Have you had a chance to review the solution we shared earlier? If the issue persists, feel free to reply so we can help further.
Thank you.