---
title: Manage workspace context-based ingress policies
description: Create workspace-level context-based ingress policies and attach them to Databricks workspaces to control public, private, and cross-workspace access.
canonical_url: https://docs.databricks.com/gcp/en/security/network/front-end/manage-ingress-workspace
---

# Manage workspace context-based ingress policies

This page shows account admins how to create a workspace-level network policy, configure its ingress rules for public, private, and cross-workspace access, and attach it to workspaces.

For an overview of context-based ingress control, including enforcement modes, auditing, how ingress interacts with other network controls, and the API and Terraform options, see [Context-based ingress control](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md). For serverless egress control, see [What is serverless egress control?](https://docs.databricks.com/gcp/en/security/network/serverless-network-security/network-policies.md).

To manage the account-level policy, see [Manage account context-based ingress policies](https://docs.databricks.com/gcp/en/security/network/front-end/manage-ingress-account.md).

## Requirements

* You must be an account admin.
* Your Databricks account must be on the Enterprise tier.

> [!NOTE]
>
> To enforce your ingress network policy on connections that can originate anywhere in the world, Databricks distributes your policy configuration to enforcement infrastructure in all Databricks regions, including regions where you do not have a workspace.

### <a id="access" />Access network policies

Use a network policy to define ingress and egress rules for one or more workspaces. To manage network policies in your account:

1. From the [account console](https://accounts.gcp.databricks.com), click **Security**.
2. Click the **Networking** tab.
3. Under **Policies**, click **Context-based ingress & egress control**.

Workspace-level policies are defined under **Workspace level policies**.

> [!NOTE]
>
> The default workspace-level policy applies to any workspace without another network policy. Databricks doesn't recommend modifying its ingress rules. Instead, create a new policy and attach it to specific workspaces.

### <a id="create" />Create a workspace network policy

1. Click **Create new network policy**.
2. Enter a **Policy name**.
3. Click the **Ingress** tab. To set egress rules, see [Set egress rules](https://docs.databricks.com/gcp/en/security/network/serverless-network-security/manage-network-policies.md#set).
4. Select a network access mode (for both public network access and private network access):
   * **Allow access from all sources**: Allow unrestricted inbound access over the internet.
   * **Restrict access based on request context**: Deny inbound access by default and allow access only through explicit **Allow rules**.

![Network policy details.](https://docs.databricks.com/gcp/en/images/security/network/ingress-policy.png)

### <a id="set" />Configure ingress rules

When you use restricted access mode:

* The policy denies access by default.
* The policy grants access only when a request matches an explicit **Allow rule**.
* **Deny rules** are exceptions to **Allow rules**. For example, you can allow a broad network range while denying access to specific identities within that range. If a request matches both an allow rule and a deny rule, the request is denied.

To configure an allow or deny rule:

1. Click **Add rule** above the **Allow rules** or **Deny rules** lists.

2. Select an access type:

   * **Workspace UI**: Allow access to the workspace UI.
   * **API**: Allow or deny access to Databricks APIs. Optionally, select specific [API scopes](https://docs.databricks.com/api/workspace/api/scopes) to narrow the rule, choosing **IN** to match only the selected scopes or **NOT IN** to match all API scopes except them. API scopes can only be specified in Allow rules, not Deny rules:
     * **All APIs**: Applies to all Databricks API calls.
     * **Apps**: Applies to Databricks Apps API endpoints.
     * **Dashboard**: Applies to Databricks dashboard API endpoints.
     * **Model serving**: Applies to model serving API endpoints.
   * **Apps runtime**: Allow access to Databricks Apps deployments.

3. Select an identity type:

   * **All users and service principals**: Allow access to both users and service principals.
   * **All users**: Allow access only to users in the workspace.
   * **All service principals**: Allow access only to service principals in the workspace.
   * **Selected identities**: Allow access only to specific users or service principals. Choose the identities from the **Subjects** list.

   > [!NOTE]
   >
   > For **Lakebase runtime** and **Apps runtime** access types, the only supported identity type is **All users and service principals**. Other identity options cannot be selected.

4. Select a source. The available sources depend on whether you are configuring public, private, or cross-workspace access, described in the following sections.

5. Click **Save**.

> [!NOTE]
>
> You can define multiple allow and deny rules to control access based on client identity, client source, or access scope (access type).

#### <a id="public" />Public network access

For public network access, select one of the following sources:

* **All public IPs**: Allow access from all public IPs.
* **Selected IPs**: Allow access from only specific IPs. Enter the IPs separated by commas.
* **Partner Platforms**: Allow requests from a third-party software as a service (SaaS) client, such as Power BI, Tableau Cloud, dbt Cloud, ChatGPT, or Claude, or from the Databricks Genie apps for Slack and Microsoft Teams. Databricks keeps each partner's IP ranges or OAuth app current. Select the partner in **Partner name**, and, for partners that support it, optionally select **Regions**. Partner platforms are available in allow rules only. See [Allow partner platforms in context-based ingress policies](https://docs.databricks.com/gcp/en/security/network/front-end/partner-platforms.md).

For **Deny rules** with selected IPs, choose one of the following:

* **IN**: Denies access from IPs that are in the specified source.
* **NOT IN**: Denies access from IPs that are not in the specified source.

> [!NOTE]
>
> Public network source rules in a context-based ingress policy evaluate the public IP address of incoming requests. The following exceptions apply to compute traffic:
>
> * **Classic compute**: When Private Service Connect isn't configured, requests from classic compute are automatically allowed, regardless of public network source rules. When inbound or classic compute plane Private Service Connect is configured, classic compute must connect through Private Service Connect, and its public IP addresses are no longer automatically allowed.
> * **Serverless compute**: Requests from serverless compute to the same workspace aren't affected by public network source rules.
> * **Cross-workspace access**: Requests between workspaces travel over the cloud provider's network backbone and aren't governed by public network source rules. To control these requests, configure [cross-workspace access](https://docs.databricks.com/gcp/en/security/network/front-end/manage-ingress-workspace.md#cross-workspace) policies.

#### <a id="private" />Private network access

> [!NOTE]
> **Beta**
>
> Private access to workspaces using context-based ingress is in [Beta](https://docs.databricks.com/gcp/en/release-notes/release-types.md). To use it, an account admin must turn on **Context-Based Ingress: Workspace Private Access Policies** from the account console **Previews** page. See [ Manage account-level previews](https://docs.databricks.com/gcp/en/admin/workspace-settings/manage-previews.md#account).

For private network access, select one of the following sources:

* **All registered private endpoints**: Allow access from all registered private endpoints.
* **Selected registered private endpoints**: Allow access from only specific registered private endpoints.

For the relationship between a private access policy and your workspace's private access settings, see [Relationship with other controls](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md#relationship). For end-to-end inbound Private Service Connect setup, see [Configure private access policy](https://docs.databricks.com/gcp/en/security/network/front-end/front-end-private-connect.md#private-access).

#### <a id="cross-workspace" />Cross-workspace access

> [!NOTE]
> **Beta**
>
> Cross-workspace access is in [Beta](https://docs.databricks.com/gcp/en/release-notes/release-types.md).

Cross-workspace access controls which source workspaces can reach this workspace over serverless traffic, using the same identities and allow and deny rules as other traffic sources. Select **Selected workspaces** as the source and list the workspace IDs to allow.

If you leave the policy in compatibility mode, it does not govern cross-workspace ingress and the workspace's pre-existing network controls apply. To configure cross-workspace access on both the ingress and egress sides, and to review its limitations, see [Configure cross-workspace ingress access](https://docs.databricks.com/gcp/en/security/network/front-end/cross-workspace-access.md#cross-workspace-ingress).

### <a id="enforce" />Set the enforcement mode

Dry run mode lets you test your policy and monitor inbound connections without blocking any access. When dry run mode is enabled, requests that violate the policy are logged but not blocked. For details, see [Enforcement modes](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md#enforcement-modes).

1. Set the policy enforcement mode to **Enforced for all products** or **Dry run mode for all products**.
2. Click **Create**.

![Set policy enforcement.](https://docs.databricks.com/gcp/en/images/security/network/ingress-dry-run.png)

### <a id="attach" />Attach a policy to workspaces

If you have updated your default policy with additional configurations, they are automatically applied to workspaces that don't have an existing network policy.

To associate your workspace with a different policy, follow these steps:

1. In the account console, click **Workspaces**.
2. Select a workspace.
3. In **Network Policy**, click **Update network policy**.
4. Select the desired network policy from the list.
5. Click **Apply policy**.

![Update network policy.](https://docs.databricks.com/gcp/en/images/security/network/workspace-seg.png)

> [!NOTE]
>
> Policy changes, such as creating, updating, or attaching, typically take 10 to 15 minutes to take effect. During this window, enforcement might be inconsistent as the change propagates. Allow for this delay before relying on updated policies.

## <a id="api-terraform" />Configure using the API or Terraform

In addition to the account console, you can configure context-based ingress policies using the Databricks REST API or Terraform. See [API and Terraform](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md#api-terraform).

## <a id="denial" />Check denial logs

Denial logs are stored in the `system.access.inbound_network` table in Unity Catalog. To access denial logs, verify the access schema is enabled on your Unity Catalog metastore. See [Enable system tables](https://docs.databricks.com/gcp/en/admin/system-tables/index.md#enable). For the fields captured in each entry, see [Auditing](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md#auditing).

Use a SQL query like the following example to view denial events. If dry-run logs are enabled, the query returns both denial logs and dry-run logs, which you can distinguish using the `policy_outcome` column. Denial logs have a `DENIED` value, while dry-run logs show `DRY_RUN_DENIAL`.

The following example retrieves logs from the last 2 hours:

```sql
SELECT *
FROM system.access.inbound_network
WHERE event_time >= CURRENT_TIMESTAMP() - INTERVAL 2 HOUR
ORDER BY event_time DESC;
```

> [!NOTE]
>
> Logs might not appear immediately. There might be a delay of several minutes between the time of access and when the denial logs appear.

## <a id="additional-resources" />Additional resources

* [Context-based ingress control](https://docs.databricks.com/gcp/en/security/network/front-end/context-based-ingress.md)
* [Allow partner platforms in context-based ingress policies](https://docs.databricks.com/gcp/en/security/network/front-end/partner-platforms.md)
* [Cross-workspace access](https://docs.databricks.com/gcp/en/security/network/front-end/cross-workspace-access.md)
* [What is serverless egress control?](https://docs.databricks.com/gcp/en/security/network/serverless-network-security/network-policies.md)

- [Manage account context-based ingress policies](https://docs.databricks.com/gcp/en/security/network/front-end/manage-ingress-account.md)
