CertSafari
    Databricks Certified Generative AI Engineer Associate· Lessons

    Domain 4 · Lesson 29/56

    Access control for Model Serving endpoints: identities, permissions, secrets and instance profiles

    Control access to resources from model serving endpoints

    18 min read
    1.47% of exam
    10 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Identify whose identity a serving endpoint uses to reach Unity Catalog and other Databricks resources, and which grants it needs
    • Choose between automatic authentication passthrough, on-behalf-of-user authentication and manual credentials for an agent
    • Separate CAN QUERY users from CAN MANAGE users, and describe the ingress and egress network controls around an endpoint
    • Pass an external API key to an endpoint through a {{secrets/scope/key}} environment variable, with the secret scope prepared for it
    • Attach an AWS instance profile to an endpoint and decide when it fits better than a secret

    Key concept

    Recorded endpoint creator — When an endpoint is created, Databricks records the calling identity, usually a service principal. That identity's grants decide which Unity Catalog resources the endpoint can reach. It stays fixed for the endpoint's whole life and is re-checked on every update.

    1.Whose permissions a serving endpoint uses

    A model behind a serving endpoint almost always reaches past itself. A RAG chain reads a Vector Search index, an agent calls a Unity Catalog function, and a LangChain model calls OpenAI. Each of those calls runs as some identity, and access control on an endpoint begins with knowing which identity that is.

    For Unity Catalog, the default answer is the recorded creator. Databricks stores whoever called the create API as the endpoint's creator. Treat that as a deliberate choice, because it cannot be changed afterwards. If that identity later loses its grants or leaves the workspace, there is no repair: you delete the endpoint and recreate it under a service principal that has the right permissions. This is why the recorded creator is typically a service principal and not a person.

    Some grants are checked before the endpoint starts, and others only fail once it serves traffic. To serve a Unity Catalog model, the recorded creator needs USE CATALOG on the catalog, USE SCHEMA on the schema and EXECUTE on the model. Databricks checks these when the endpoint is created or updated, and a missing one fails the request immediately. If the model declares transitive function dependencies, the creator also needs EXECUTE on those upstream functions. Grants that are only needed at query time are not checked in advance. A missing one surfaces as a runtime error on live requests. That is the worse failure, because the deployment looked healthy.

    Agents add a choice about how they authenticate to the Databricks resources they call. There are three patterns:

    • Automatic authentication passthrough. You declare the resources the agent depends on, such as an AI Search index, an LLM endpoint or a Unity Catalog function, when you log the agent. Databricks then handles authentication to those resources for the deployed endpoint, so nobody stores a token by hand. When an agent hits authentication errors after deployment, the first thing to check is whether it was logged with those resources. A missing resource is fixed by logging the agent again and redeploying it.
    • On-behalf-of-user authentication. The agent uses ModelServingUserCredentials to act as whoever sent the request. Use it when each end user's own Unity Catalog permissions, including their row and column restrictions, must apply instead of one shared identity's permissions.
    • Manual authentication. You supply credentials yourself through environment variables. These settings take precedence: manual settings override any automatic configuration, so a forgotten environment variable can quietly replace passthrough.
    Choosing how an agent on Model Serving authenticates to the resources it calls
    MechanismIdentity used at query timeChoose it when
    Automatic authentication passthroughA shared identity Databricks manages for the resources declared when the agent was loggedEvery caller should see the same data and you do not want to handle credentials by hand
    On-behalf-of-user (ModelServingUserCredentials)The calling userEach user's own permissions must decide what the agent can read
    Manual (environment variables)Whatever credential you supplyThe target is outside Databricks, or you deliberately want to override automatic configuration

    Checkpoint 1 of 8· Check yourself

    A service principal creates a serving endpoint for a Unity Catalog model. It holds USE CATALOG on the catalog and USE SCHEMA on the schema, but nobody granted it EXECUTE on the model. What happens?

    Checkpoint 2 of 8· Exam question

    A GenAI engineer is deploying an agent to a Model Serving endpoint. The agent must query a Unity Catalog Vector Search index and call a Unity Catalog function, and the team wants Databricks to manage and rotate credentials automatically instead of storing any secrets by hand. How should the engineer configure this?

    Checkpoint 3 of 8· Exam question

    A team is deploying an agent whose Unity Catalog table queries must respect each individual end user's own row- and column-level permissions rather than a single shared identity's permissions. Which configuration achieves this on a Model Serving endpoint?

    Sources123

    2.Who can query, who can manage, and which networks can reach the endpoint

    The permissions on the endpoint itself are a separate layer from the identity the endpoint uses. CAN MANAGE covers administrative operations: changing the configuration, the served entities or the governance settings. Whoever creates an endpoint receives CAN MANAGE on it automatically. Most people only need to send requests, which is the CAN QUERY level.

    Handing out CAN MANAGE too freely is how guardrails get bypassed. Someone who can edit an endpoint can loosen the rate limits or guardrails that were configured on it. The recommended setup has three parts. Only admins can create endpoints. Only admins hold CAN MANAGE. Everyone else gets query access on approved endpoints only. Foundation Model API endpoints are stricter still: only workspace admins can modify their governance settings. That puts the decision about how the pay-per-token models are governed with admins and not with individual developers.

    Network controls apply in both directions. For inbound traffic, Model Serving endpoints respect the workspace's ingress rules, such as IP allowlists and PrivateLink. A request from an address outside the allowlist is refused even if the caller has CAN QUERY. By default, Model Serving does not support PrivateLink to external endpoints.

    Outbound traffic is governed by serverless egress control through network policies, which requires the Enterprise tier. Under Restricted Access, serverless workloads can reach only Unity Catalog external locations and destinations listed explicitly in the policy. An endpoint that calls an external model provider therefore breaks under a restricted policy until the provider's DNS names are added as allowed destinations. Before enforcing a policy, you can run it in dry-run mode to see what it would block.

    Checkpoint 4 of 8· Check yourself

    Your workspace's network policy is switched from Full Access to Restricted Access. An endpoint serving a LangChain model that calls OpenAI starts failing, even though its grants and secrets have not changed. What fixes it?

    Sources4567

    3.Passing credentials through secrets-based environment variables

    Some targets cannot use Unity Catalog grants or passthrough at all. An OpenAI API key or a token for a third-party SaaS model are examples. For these, Model Serving injects environment variables into the served model. There are two kinds, and the only difference between them is the syntax of the value.

    A plain text environment variable holds its value as written in the endpoint configuration, so use it only for values that don't need to be hidden. A secrets-based environment variable holds a reference in the form {{secrets/scope/key}}. At serving time, the endpoint fetches the secret from Databricks secrets and assigns it to the named variable inside the model. Any value that does not follow that exact syntax is treated as plain text, so a raw key pasted into the field is stored as a visible configuration value. Databricks recommends this pattern for OpenAI and LangChain model flavors, and for any SaaS model that authenticates with API keys.

    Creating an endpoint whose OPENAI_API_KEY is resolved from a secret at serving time (POST /api/2.0/serving-endpoints)json
    {
      "name": "endpoint-name",
      "config": {
        "served_entities": [
          {
            "entity_name": "model-name",
            "entity_version": "1",
            "workload_size": "Small",
            "scale_to_zero_enabled": "true",
            "environment_vars": {
              "OPENAI_API_KEY": "{{secrets/my_secret_scope/my_secret_key}}"
            }
          }
        ]
      }
    }

    The secret scope has to be ready before the endpoint can use it. Create the scope with databricks secrets create-scope my_secret_scope, then store the key with databricks secrets put-secret my_secret_scope my_secret_key. The endpoint creator needs READ access to every secret the configuration references. The scope creator gets MANAGE by default. If a separate service principal creates the endpoint, grant it access with databricks secrets put-acl <scope-name> <principal> <permission>. A put-acl call overwrites any permission that principal already had on the scope; it does not add to it.

    Two habits keep this manageable. Align scopes to an application or role instead of a person, so the scope outlives any one employee. Keep sensitive information out of scope names, because every user in the workspace can read them. The same environment_vars field accepts the reference whether you use the Serving UI's Advanced configuration, the REST API or an SDK. You can also add it to an existing endpoint by updating its config.

    Checkpoint 5 of 8· Fill the gap

    Which value for OPENAI_API_KEY makes the endpoint fetch the key from Databricks secrets at serving time, so the key is not stored as a visible plain text value?

    {
      "name": "endpoint-name",
      "config": {
        "served_entities": [
          {
            "entity_name": "model-name",
            "entity_version": "1",
            "workload_size": "Small",
            "scale_to_zero_enabled": "true",
            "environment_vars": {
              "OPENAI_API_KEY": " ? "
            }
          }
        ]
      }
    }

    Checkpoint 6 of 8· Exam question

    An engineer needs a Model Serving endpoint to call an external, non-Databricks API using an API key, and that key must never appear in plaintext in the endpoint configuration. What should the engineer do?

    Sources89

    4.Instance profiles for AWS resources, and choosing a mechanism

    On AWS, an endpoint can take on an IAM role instead of carrying a key. You attach an instance profile, and the model can then reach any AWS resource that the profile's policy permits. You set it with the instance_profile_arn field on a served entity, either at creation or in a config update, or under Advanced configuration in the Serving UI. Feature lookups for the model should use the same instance profile you attached to the endpoint.

    Updating an existing endpoint to use an instance profile (PUT /api/2.0/serving-endpoints/{name}/config)json
    {
      "served_entities": [{
        "entity_name": "ads1",
        "entity_version": "2",
        "workload_size": "Small",
        "scale_to_zero_enabled": true,
        "instance_profile_arn": "arn:aws:iam::<aws-account-id>:instance-profile/<instance-profile-name-2>"
      }]
    }

    Most instance-profile failures come from one of three details. First, endpoints run on serverless compute, so the profile's IAM role needs a trust relationship configured for serverless compute. Without it, you get the "IAM role does not have the required trust relationship" error. Second, if the profile was already set up for serverless SQL, check that its access policy also covers what the models need. Third, Databricks checks the endpoint creator's permission to use the instance profile when the endpoint is created.

    Data access then runs on STS temporary security credentials, and those cannot get around a network restriction. An egress policy that blocks a bucket blocks it for the instance profile too. Changes made in workspace Settings also take effect later than you might expect. If you edit the profile's IAM role, running endpoints keep using the old role until the endpoint updates. If you delete the profile from Settings, endpoints already running with it are not affected.

    Choosing a mechanism for an endpoint to reach a resource
    MechanismConfigured throughFits
    Unity Catalog grants to the recorded creatorGrants on the catalog, schema, model and functionsUnity Catalog models and their function dependencies
    Secrets-based environment variableenvironment_vars with {{secrets/scope/key}}API keys and tokens for OpenAI, other external model endpoints or SaaS services
    Plain text environment variableenvironment_vars with a literal valueSettings that don't need to be hidden, such as ENABLE_FEATURE_TRACING
    Instance profileinstance_profile_arnAWS resources the profile's IAM role allows

    Checkpoint 7 of 8· Check yourself

    An admin deletes an instance profile from workspace Settings. Two endpoints are already running with that profile attached, and nobody has updated them since. What happens to those two endpoints?

    Checkpoint 8 of 8· Match them up

    Match each access mechanism to the endpoint need it fits best

    Tap a term, then the definition that fits it.

    Sources10

    Practise it for real

    Serve a model that reads an external API key from a Databricks secret, without the key appearing in the endpoint configuration.

    1. 1.Run databricks secrets create-scope my_secret_scope, then databricks secrets list-scopes.

      Why: A secrets-based environment variable can only reference a scope that already exists.

      You should see: my_secret_scope appears in the list, and you hold MANAGE on it as its creator.

    2. 2.Run databricks secrets put-secret my_secret_scope my_secret_key and enter the API key when prompted.

      Why: Entering the key interactively keeps it out of your shell history and out of any config file.

      You should see: databricks secrets list-secrets my_secret_scope shows the key name my_secret_key and does not show its value.

    3. 3.If a service principal will create the endpoint, run databricks secrets put-acl my_secret_scope followed by the service principal's applicationId and the permission READ.

      Why: The endpoint creator needs READ access to every secret the configuration references.

      You should see: databricks secrets get-acl my_secret_scope with the same applicationId returns the READ permission.

    4. 4.Create the endpoint with environment_vars set to {"OPENAI_API_KEY": "{{secrets/my_secret_scope/my_secret_key}}"}.

      Why: The double-brace reference tells Model Serving to fetch the secret at serving time.

      You should see: The endpoint configuration shows the reference string and not the key itself.

    Stuck? Get a nudge

    If the endpoint configuration shows your actual key, check the value syntax. Anything not written as {{secrets/scope/key}} is stored as plain text.

    Sources

    (10)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “USE CATALOG on the catalog, USE SCHEMA on the schema, EXECUTE on the model”
      ↩︎ Whose permissions a serving endpoint uses
      “the recorded creator also needs EXECUTE on those upstream functions”
      ↩︎ Whose permissions a serving endpoint uses
      “missing grants cause runtime errors when the endpoint serves traffic”
      ↩︎ Whose permissions a serving endpoint uses
      “is used to access Unity Catalog resources on behalf of the endpoint and cannot be changed after creation”
      ↩︎ Key concept
      “Configuration and served-entity updates re-evaluate the recorded creator's workspace membership and grants.”
      ↩︎ Exam trap 1
      “Updates fail with PERMISSION_DENIED if the recorded creator is no longer a workspace member, even when the caller has valid permissions.”
      ↩︎ Prediction
      “Grants validated at endpoint creation or update cause the request to fail with PERMISSION_DENIED if missing.”
      ↩︎ Checkpoint
      “Add an instance profile to connect to AWS resources from your endpoint. Add environment variables to connect to resources from your endpoint”
      ↩︎ Checkpoint
    2. 2.
      “verify that it was logged with the necessary resources for automatic authentication passthrough”
      ↩︎ Whose permissions a serving endpoint uses
      “To re-add missing or incorrect resources, log the agent and deploy it again.”
      ↩︎ Whose permissions a serving endpoint uses
      “Manual settings override any automatic authentication configurations.”
      ↩︎ Exam trap 2
    3. 3.
      “Use ModelServingUserCredentials so the agent acts with the calling user's permissions.”
      ↩︎ Whose permissions a serving endpoint uses
    4. 4.
      “Endpoint admin operations require CAN MANAGE on that endpoint.”
      ↩︎ Who can query, who can manage, and which networks can reach the endpoint
      “restrict endpoint creation and CAN MANAGE to admins, and grant other users only query permissions on approved endpoints.”
      ↩︎ Who can query, who can manage, and which networks can reach the endpoint
    5. 5.
    6. 7.
      “add the external model provider's DNS names as allowed destinations in the network policy”
      ↩︎ Who can query, who can manage, and which networks can reach the endpoint
      “When a workspace uses restricted access, add the external model provider's DNS names as allowed destinations in the network policy”
      ↩︎ Checkpoint
    7. 8.
      “The endpoint creator must have READ access to the Databricks secrets being referenced in the configs.”
      ↩︎ Passing credentials through secrets-based environment variables
      “Databricks recommends this feature for deploying OpenAI and LangChain MLflow model flavors to serving.”
      ↩︎ Passing credentials through secrets-based environment variables
      “Otherwise, the environment variable is considered a plain text environment variable.”
      ↩︎ Exam trap 3
    8. 9.
      “Databricks recommends aligning secret scopes to roles or applications rather than individuals.”
      ↩︎ Passing credentials through secrets-based environment variables
      “Making a put request for a principal that already has an applied permission overwrites the existing permission level.”
      ↩︎ Passing credentials through secrets-based environment variables
    9. 10.
      “Your instance profile's IAM role must have a trust relationship configured for serverless compute.”
      ↩︎ Instance profiles for AWS resources, and choosing a mechanism
      “The endpoint creator's permission to an instance profile is validated at endpoint creation time.”
      ↩︎ Instance profiles for AWS resources, and choosing a mechanism
      “STS temporary security credentials are used to authenticate data access. It can't bypass any network restriction.”
      ↩︎ Instance profiles for AWS resources, and choosing a mechanism
      “endpoints running with the instance profile continue to use the old IAM role until the endpoint updates.”
      ↩︎ Instance profiles for AWS resources, and choosing a mechanism
      “that profile is used in running endpoints, the running endpoint is not impacted.”
      ↩︎ Exam trap 4
      “that profile is used in running endpoints, the running endpoint is not impacted”
      ↩︎ Checkpoint

    Ready to test yourself?

    Practise the 6 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.