Prepstellar

DP-750 · Compute and Catalog Foundations

21 cards

Compute Libraries and Access Permissions

Swipe, scroll or use ← →
  1. Install dependencies at the right scope

    Notebooks and jobs regularly need packages that the runtime does not ship. The first decision is not which package, but how widely the installation should reach.

    A compute-scoped library installs on the cluster and becomes available to every notebook and job that runs on that cluster. Azure Databricks reinstalls it automatically each time the cluster starts, so the environment survives restarts and nobody has to reinstall anything by hand. That is what makes a shared cluster consistent for everyone attached to it.

    A notebook-scoped library, by contrast, applies only to the session of the notebook that installed it. Nothing about it changes the cluster or affects anyone else.

    Neither scope reaches further than that: an installation never propagates to every cluster in the workspace, and it never follows a user account across workspaces.

    1 / 21
  2. Install dependencies at the right scope

    The width of compute scope is also its limitation. Because the library affects every workload on the cluster, two teams that need incompatible versions of the same package cannot both be served by one compute-scoped installation.

    Situation Approach
    A dependency everyone on the cluster shares Compute-scoped library
    Two teams needing conflicting versions, each in its own session Notebook-scoped installations, or separate clusters
    A shared cluster configuration that must stay untouched Notebook-scoped installations

    Installing both versions cluster-wide does not resolve the conflict, it stages it on the shared cluster. Storing both files in a volume and installing both cluster-wide has exactly the same effect: the scope is what matters, not where the files sit.

    2 / 21
  3. Quick check

    Two teams share a cluster and need incompatible versions of the same Python package, each only inside its own notebook session, and the shared cluster configuration must not change. What fits best?

    1. AInstall both versions as compute-scoped libraries on the shared cluster

      A compute-scoped install reaches every workload on the cluster, so both versions would collide there.

    2. BInstall one unpinned compute-scoped package and let each session resolve it

      An unpinned package still installs cluster-wide, and leaving the version unspecified adds unpredictability on top of the conflict.

    3. CUse notebook-scoped installations inside each team's own separate sessions

      Right. Notebook scope keeps each version inside its own session and leaves the shared cluster configuration untouched.

    3 / 21

  4. Where libraries come from

    Compute-scoped libraries accept three artifact kinds: Python wheels, Java JAR files, and R packages. They can be installed from a package repository or from files you control.

    Repository Supplies
    PyPI Python packages
    Maven Java and Scala libraries
    CRAN R packages

    Repositories resolve dependencies for you, which is convenient and slightly dangerous: convenience includes picking a version.

    4 / 21
  5. Where libraries come from

    For production, specify an exact version, for example pymssql==2.3.9. Without a version the latest available package is installed, and "latest" can change between two cluster starts and break code that worked yesterday. Pinning is about reproducible installations and nothing else: it does not change a package's type, it does not bypass any approval, and it grants nobody extra permission.

    Maven libraries are identified by coordinates in the format groupId:artifactId:version, such as com.microsoft.sqlserver:mssql-jdbc:13.2.1.jre11. Maven can also exclude a transitive dependency that would conflict with something already installed.

    CRAN behaves differently: it always pulls the latest version from the configured mirror. To pin an R package, store the package file in workspace files or a volume instead of installing from CRAN.

    5 / 21
  6. Quick check

    Why should a production installation from PyPI name an exact package version?

    1. ABecause the pinned version grants the installer permission to manage the cluster

      Permission to install comes from the cluster's permission level, not from how the package is written.

    2. BBecause repeated installations then produce the same package every time

      Right. Without a version, a later cluster start can silently install a newer package and break code that already worked.

    3. CBecause pinning exempts the library from approval checks on shared clusters

      Approval requirements on shared compute apply regardless of whether a version is specified.

    6 / 21

  7. Libraries kept as files

    Some libraries are not in a public repository: internally built packages, or a specific version no longer published. Store those files in workspace files or a Unity Catalog volume, and reference the file when installing.

    Location Character
    Workspace files Convenient storage with a file size limit; upload through the workspace import dialog and reference a workspace path
    Unity Catalog volumes Governed storage: access follows Unity Catalog permissions, and installations are auditable

    Both keep library management centralized instead of scattering ad-hoc installations through notebooks. A Python requirements file works from either location on recent runtimes, installing every package it lists in one step.

    7 / 21
  8. Libraries kept as files

    A volume adds one requirement of its own. The identity performing the installation must hold READ VOLUME on the volume that stores the library file. It is a read of a governed file, so the privilege needed is the one that permits reading that volume.

    Notice what it is not:

    • Not write access, and not across every volume in the catalog: reading one file needs read on that volume.
    • Not a compute permission. Cluster permission levels govern the cluster, not the contents of a volume.
    • Not a metastore-level privilege such as creating catalogs.
    8 / 21
  9. Quick check

    A library file is stored in a Unity Catalog volume. What must the installing identity hold to install it?

    1. ACREATE CATALOG on the metastore where the volume lives

      Creating catalogs is a metastore-level privilege and has nothing to do with reading one library file.

    2. BREAD VOLUME on the volume that stores the file

      Right. Installation reads the file, so the installer needs read access to the volume that holds it.

    3. CWRITE VOLUME on every volume in the catalog

      Installing a library never writes to the volume, and one file's permission does not extend to the whole catalog.

    9 / 21

  10. Keep your progress in the app

    That’s 3 of 8 quick checks. In the app they stay answered, and every lesson remembers where you left off.

  11. Approval on shared clusters

    A cluster in Standard access mode is shared by several users, so the platform will not let arbitrary code onto it. Maven coordinates, JAR paths, library file paths, and init script paths require allowlist approval, added by a metastore admin, before they can be installed.

    Two details are worth remembering. Approval entries use prefix matching, so approving a directory permits the files beneath it, and an init script needs its own entry even when it sits beside an approved JAR.

    10 / 21
  12. Approval on shared clusters

    The most common failure here comes from assuming approval is enough. An allowlist entry only permits the use of that coordinate or path; it does not grant access to the underlying data. The two checks are independent and both must pass.

    So a Standard-mode installation of a JAR stored in a volume needs three things to be true at once:

    Requirement Why
    The path is on the allowlist The shared cluster only runs approved code
    The installer holds READ VOLUME on the volume The file itself has to be readable
    The installer holds CAN MANAGE on the cluster Installing a library changes cluster configuration

    When an operator who manages the cluster still hits an access failure, the missing piece is one of the first two, and checking only one of them leaves the case half-diagnosed.

    11 / 21
  13. Quick check

    A Standard-mode cluster must install an approved JAR stored in a volume. The operator can manage the cluster, but the installation still fails an access check. What should be verified?

    1. AThat the path is on the allowlist and that the installing identity holds READ VOLUME on the volume

      Right. Approval and data access are separate checks, and both have to pass on top of managing the cluster.

    2. BThat the path is on the allowlist, which by itself also authorizes reading the file

      Approval permits the use of the path; it never grants the data access needed to read the file.

    3. CThat the operator holds CAN RESTART and that WRITE VOLUME is granted on the volume

      CAN RESTART is below the level required to install anything, and installation reads the file rather than writing to it.

    12 / 21

  14. Init scripts are the last resort

    An init script runs shell commands during cluster startup, before the driver and executors come up. It is the tool for system-level configuration that a library cannot provide: installing system packages, setting environment variables, or preparing a monitoring agent.

    Databricks does not recommend init scripts as the normal way to install libraries. Compute-scoped libraries are the better path for ordinary packages, and they are simpler to reason about.

    Two consequences follow from running at startup. Scripts execute in the order you specify, and a script returning a non-zero exit code prevents the cluster from starting at all, which is a deliberate protection against running with an incomplete configuration.

    An init script also solves nothing about permissions: someone who cannot modify the cluster cannot add one, and a dependency needed by a single notebook session belongs in a notebook-scoped installation.

    13 / 21
  15. Quick check

    When is an init script the right choice instead of a compute-scoped library?

    1. AWhenever the package is a Python wheel published on PyPI

      A published wheel is exactly the ordinary case that compute-scoped libraries handle better.

    2. BWhen cluster startup needs system-level configuration that a library cannot perform

      Right. System packages, environment variables, and similar startup configuration are outside what a library can do.

    3. CWhen a dependency should apply to one notebook session only

      A single session is served by a notebook-scoped installation; an init script affects the whole cluster at startup.

    14 / 21

  16. Four levels of compute permission

    Compute permissions are workspace-level and are separate from Azure subscription permissions. They build up in four tiers, each adding to the one below it.

    Level Grants
    NO PERMISSIONS No interaction at all: the compute cannot be seen, attached to, or monitored
    CAN ATTACH TO Attach notebooks, view the Spark UI, and view compute metrics — usage and monitoring, no lifecycle control
    CAN RESTART Everything above, plus terminate, start, and restart the compute resource
    CAN MANAGE Everything above, plus edit configuration, install libraries, resize the cluster, and change other users' permissions
    15 / 21
  17. Four levels of compute permission

    Two boundaries in that ladder decide most questions.

    The first: CAN ATTACH TO cannot control the lifecycle. It is the usage tier — run work, watch it execute — and the person who has it cannot stop or restart anything, resize the cluster, install a shared library, or change anyone's permissions.

    The second: installing a compute-scoped library requires CAN MANAGE. Adding a library modifies cluster configuration, which is why the library installation interface is unavailable below that level, and why CAN RESTART is not enough even though it sounds close. Restarting is lifecycle; installing is configuration.

    Workspace admins hold CAN MANAGE on every compute resource, and whoever creates a compute resource owns it with the same level.

    16 / 21
  18. Quick check

    Which permission level is required to install a compute-scoped library on a cluster?

    1. ACAN MANAGE

      Right. Installing a library changes the cluster's configuration, which is the authority this level adds.

    2. BCAN ATTACH TO

      This level covers attaching notebooks and monitoring; it never reaches configuration.

    3. CCAN RESTART

      Lifecycle control stops short of configuration, so it cannot install a library.

    17 / 21

  19. Grant access with least privilege

    Permissions are granted in the Azure Databricks workspace interface, not in the Azure portal, and changes take effect immediately — no cluster restart is required to add or revoke access.

    Prefer grants to groups rather than to individuals. When someone joins or leaves a team, membership does the work, and no one has to revisit every compute resource hunting for stale access.

    Then apply least privilege by mapping each role to the lowest level that lets it work:

    Role Needs to Level
    Analyst running notebooks and inspecting execution Attach and monitor CAN ATTACH TO
    Team lead recovering a stopped or misbehaving cluster Control availability CAN RESTART
    Platform owner changing configuration and libraries Configure CAN MANAGE

    Reading that table upwards is the sanity check: an analyst who can restart production compute, or a lead who can rewrite its configuration, has more authority than the job requires.

    18 / 21
  20. Quick check

    An analyst runs notebooks and inspects Spark execution; a team lead must be able to recover a stopped cluster; only the platform owner may change configuration or libraries. Which mapping applies least privilege?

    1. AAnalyst: CAN MANAGE; team lead: CAN ATTACH TO; owner: CAN RESTART

      This hands the analyst full configuration control and leaves the owner unable to configure anything.

    2. BAnalyst: CAN RESTART; team lead: CAN MANAGE; platform owner: CAN ATTACH TO

      The analyst gains lifecycle control that was never required, and the owner is left below the level needed to install libraries.

    3. CAnalyst: CAN ATTACH TO; lead: CAN RESTART; owner: CAN MANAGE

      Right. Each role receives exactly the tier its work requires: usage, then lifecycle, then configuration.

    19 / 21

  21. Key takeaways

    • Compute-scoped libraries serve every notebook and job on the cluster and are reinstalled at each start; conflicting versions belong in notebook-scoped installations or separate clusters.
    • Pin an exact version when reproducibility matters, remember Maven's groupId:artifactId:version coordinates, and store files in workspace files or volumes when a repository cannot supply the version you need.
    • Treat the allowlist and file-access privileges as separate checks: approval permits the path, READ VOLUME permits reading the file.
    • CAN ATTACH TO permits use and monitoring, CAN RESTART adds lifecycle control, and CAN MANAGE adds configuration, library, and permission control.
    • Installing a compute-scoped library requires CAN MANAGE; grant to groups, apply least privilege, and expect permission changes to take effect immediately.
    20 / 21
  22. Quick check

    Which statement keeps scope and authority straight?

    1. AA notebook-scoped install reconfigures the cluster, and CAN RESTART covers library installation

      Notebook scope changes nothing on the cluster, and lifecycle control stops short of installing anything.

    2. BA compute-scoped library serves every workload on its cluster, and installing one requires CAN MANAGE

      Right. The scope explains who is affected, and the permission level explains who is allowed to make the change.

    3. CAn allowlist entry supplies both approval and the data access needed to read the library file

      Approval and data access are independent: the installer still needs read access to the volume holding the file.

    21 / 21

  23. 8 quick checks · then the test

    In the app, finishing the quick checks opens this lesson’s 10-question test, and the ones you miss come back exactly when you’re about to forget them.

The whole course, on your phone

Lessons you can read, audio you can listen to on the way to work, and practice that remembers what you got wrong.