> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to OneLake using a user-assigned managed identity

> Use this Azure identity to read an existing OneLake table.

How-to guideApplies to: Unified engine deployments

Use this Azure identity to read an existing OneLake table.

## Before you start

Attach the user-assigned identity to the Azure runtime. Use that identity client
ID as the sole selector. Grant it access to the workspace and data.

Use an existing catalog with at least one readable Iceberg table. The engine and
workers must reach the catalog and its table storage. Have the remote identity
and permissions ready before creating the Unified registration. Replace the
namespace and table with one you know has data. The service must return usable
temporary storage credentials, or the table location must already have
configured storage access in Unified. Requesting delegation alone does not grant
access. This recipe covers the restricted OneLake read interface.

## Values to collect

* Identity-specific values below; OneLake REST URI, warehouse, namespace, and
  table.

## Run the SQL

Replace every `<placeholder>` before running. Use unused names for the resources
below. Run the statements in order in Workbench.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE CREDENTIAL recipe_azure_user_assigned_identity_auth USING azure
OPTIONS (
  'authentication' = 'managed_identity',
  'scopes' = 'https://storage.azure.com/.default',
  'client_id' = '<managed-identity-client-id>'
);

CREATE CATALOG recipe_azure_user_assigned_identity USING `iceberg-rest`
OPTIONS (
  'catalog.type' = 'onelake',
  'uri' = '<onelake-rest-uri>',
  'warehouse' = '<warehouse>',
  'auth.type' = 'bearer',
  'scope' = 'https://storage.azure.com/.default',
  'header.x-iceberg-access-delegation' = 'vended-credentials'
)
CREDENTIALS ('auth' = 'recipe_azure_user_assigned_identity_auth');

SELECT *
FROM recipe_azure_user_assigned_identity.`<namespace>`.`<table>`
LIMIT 5;
```

## Check the result

The SELECT should return up to five rows from the chosen table. Use a nonempty
table for this check. This verifies both metadata and table-file access;
creating the registration alone does not verify either.

## Clean up

This removes only the Unified registrations. It leaves the remote catalog and
its tables in place.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
DROP CATALOG recipe_azure_user_assigned_identity;
DROP CREDENTIAL recipe_azure_user_assigned_identity_auth;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.