RepoMicrosoftMicrosoftpublished Dec 13, 2023seen 1d

microsoft/fabric-sdk-go

Go

Open original ↗

Captured source

source ↗
published Dec 13, 2023seen 1dcaptured 1dhttp 200method plain

microsoft/fabric-sdk-go

Description: Microsoft Fabric SDK for GoLang

Language: Go

License: MIT

Stars: 17

Forks: 5

Open issues: 1

Created: 2023-12-13T03:43:19Z

Pushed: 2026-06-25T06:10:42Z

Default branch: main

Fork: no

Archived: no

README:

Microsoft Fabric SDK for Go

![GoDoc](https://pkg.go.dev/github.com/microsoft/fabric-sdk-go) ![Go Report Card](https://goreportcard.com/report/github.com/microsoft/fabric-sdk-go)

This project provides a data-plane Go SDK for Microsoft Fabric. Microsoft Fabric is an all-in-one analytics solution for enterprises that covers everything from data movement to data science, Real-Time Analytics, and business intelligence. It offers a comprehensive suite of services, including data lake, data engineering, and data integration, all in one place.

> [!WARNING] > This code is experimental and provided solely for evaluation purposes. It is NOT intended for production use and may contain bugs, incomplete features, or other issues. Use at your own risk, as it may undergo significant changes without notice, and no guarantees or support are provided. By using this code, you acknowledge and agree to these conditions. Consult the documentation or contact the maintainer if you have questions or concerns.

Getting started

Prerequisites

Install modules

Install the fabric and azidentity modules for Go with go get:

go get -u github.com/microsoft/fabric-sdk-go
go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity

The azidentity module is used for Microsoft Entra ID authentication with Microsoft Fabric.

Examples

Examples for various scenarios can be found in the *_example_test.go files under each package.

Authentication

To work with Fabric SDK, like many other Microsoft services, first you need to authenticate and get authorization to Fabric services using the Microsoft Entra ID.

The azidentity module provides Microsoft Entra ID (formerly Azure Active Directory) token authentication support across the Microsoft SDKs. It includes a set of TokenCredential implementations, which can be used with Microsoft SDKs clients supporting token authentication, include Fabric SDK.

This example demonstrates authenticating with DefaultAzureCredential.

import "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
// handle error
}

Explore all Credential Types from azidentity module to choose the ones that best suit your needs.

> [!NOTE] > DefaultAzureCredential is intended to simplify getting started with the SDK by handling common scenarios with reasonable default behaviors. Developers who want more control or whose scenario isn't served by the default settings should use other credential types. Read more in the Key concept section.

Microsoft Entra ID app

A Microsoft Entra ID app controls access levels for your Fabric services. Before you can make any calls, you'll have to register a Microsoft Entra ID app. The app allows you to:

  • Establish an identity for your app
  • Let your app access the Microsoft Fabric
  • Specify your app's Fabric permissions

Please follow Create a Microsoft Entra ID app guide how to register your app and setup delegated scopes.

Azure CLI usage

To use Azure CLI cached credentials that will be consumed by azidentity, additionally to basic configuration described above, you have to Expose API and pre-authorize Azure CLI to access your Microsoft Entra ID app.

In the Expose an API menu of your app, you need to define your application ID URI:

  • Application ID URI: api:// - you can use default client id, or provide own name, for example:
api://my_fabric_app
  • Add required scope in the Scopes defined by this API section:

1. Scope name: default 1. Who can consent: Admins and users 1. Admin consent display name: My Fabric App 1. Admin consent description: Allows connection to backend services for My Fabric App 1. User consent display name: My Fabric App 1. User consent description: Allows connection to backend services for My Fabric App 1. State: Enabled

  • You will finally need to pre-authorize Azure CLI to access your API by adding Azure CLI's client application 04b07795-8ddb-461a-bbee-02f9e1bf7b46 in the Authorized client applications section.

After above steps you should be able to authenticate using Azure CLI:

az login --allow-no-subscriptions --scope api://my_fabric_app/default

Client usage

The Fabric Go SDK utilizes a client factory pattern that allows users to interact with various Fabric services via their respective clients.

Fabric Client

The top level client is Fabric client, which can be used to created sub clients via the Factor pattern.

import "github.com/microsoft/fabric-sdk-go/fabric"
fabClient, err := fabric.NewClient(cred, nil, nil)
if err != nil {
// handle error
}

Client Factory with Fabric Client

The Fabric client can be used to create a client for each service. This can be used to get a specific item client in the corresponding service. In the example below, we are creating a core service client that will allow us to create clients for specific items under the core service.

import "github.com/microsoft/fabric-sdk-go/fabric/core"
coreCF := core.NewClientFactoryWithClient(*fabClient)

Client Factory

Another way to create a service client is directly using the credentials from azidentity

import...

Excerpt shown — open the source for the full document.

Notability

notability 2.0/10

Minor SDK release with low traction.