Repository navigation
[Server] Add Azure service principal and GCP service account key credentials - #2179
Draft
timothyw553 wants to merge 1 commit into
Draft
timothyw553 wants to merge 1 commit into
timothyw553 wants to merge 1 commit into
Conversation
…entials Storage credentials only accepted aws_iam_role, so ADLS and GCS storage could be reached only through the legacy adls.* and gcs.* entries in server.properties, which need a service maintainer and a restart and keep cloud secrets on the server host. Part of unitycatalog#47. Add azure_service_principal {directory_id, application_id, client_secret} and gcp_service_account_key {email, private_key_id, private_key} to the credential API, with the same names as Databricks Unity Catalog, store them in the existing typed JSON blob of uc_credentials, and return the identity without the secret on get and list. A create request must carry exactly one cloud identity and an update at most one, and the cloud cannot change afterwards: external locations bind a credential to URLs of its cloud, so creating or updating an external location now rejects a credential that cannot reach the URL (file: URLs accept any). The CLI gets --azure_directory_id, --azure_application_id, --azure_client_secret and --gcp_service_account_key_file. uc_credentials.credential_type is an enum (H2, MySQL) or a check constraint (PostgreSQL) in the versioned schema, so schema step V3 widens it to the new values; an existing database takes it through bin/start-uc-server --upgrade-schema. The effect files come from build/sbt updateSchemaDumps on all three databases. Vending through these credentials still returns UNIMPLEMENTED; the next PRs in the stack add it for Azure and GCS. Co-authored-by: Isaac <[email protected]> Signed-off-by: Timothy Wang <[email protected]>
This was referenced Nov 11, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🥞 Stacked PR
Use this link to review incremental changes.
PR Checklist
docsis updatedDescription of changes
Part of #47 (Azure Data Lake Storage support) and the roadmap item "Azure + GCP external location & credential support at S3 parity". PR 1 of 4 in a stack:
Motivation
Storage credentials only accept
aws_iam_role, so an admin cannot onboard ADLS or GCS storage through the API. Those clouds are reachable only through the legacyadls.*/gcs.*entries inserver.properties, which need a service maintainer and a server restart, keep cloud secrets on the server host, and return 501 when an external location onabfss://orgs://is used for vending.API change
api/all.yamlgains two cloud identities onCreateCredentialRequest,UpdateCredentialRequestandCredentialInfo, with the same names and fields as Databricks Unity Catalog so existing clients and SDKs understand them:azure_service_principal{directory_id, application_id, client_secret}: a Microsoft Entra ID service principal with access to the storage account. This follows the preferred option in the "[Decision] Azure Storage Credential in UC OSS" design doc (Yi Li; the doc is still marked DRAFT): service principal first; managed identity needs a different workflow because the server is not a first-party Azure service.gcp_service_account_key{email, private_key_id, private_key}: a service account key with access to the bucket, the fields of the key JSON file. Chosen for consistency with the Azure decision: customer-managed secret, no server-side configuration, works on-prem. Note that Databricks Unity Catalog has deprecated this key type in favor of Databricks-managed service accounts, a first-party feature UC OSS has no equivalent of; a secretless option for UC OSS (impersonating a service account the bucket owner shares with the server) is a possible follow-up.Responses use
AzureServicePrincipalResponseandGcpServiceAccountKeyResponse, which have no secret field, mirroringAwsIamRoleRequest/AwsIamRoleResponse. The regeneratedapi/Models/*.mdandapi/README.mdare included.Server
CredentialDAOstores the new identities in the existing typed JSON blob;toCredentialInforeturns the identity without the secret.CredentialTypenow knows which URL schemes each cloud reaches.CredentialRepositoryrequires exactly one cloud identity on create and at most one on update, checks the fields are non-blank, and rejects changing a credential's cloud (external locations bind a credential to URLs of its cloud).ExternalLocationRepositoryrejects a credential that cannot reach the location's URL, on create and on update of either the URL or the credential.file:URLs accept any credential, as the existing tests already rely on.V3__add_azure_gcp_credential_typesfor H2, MySQL and PostgreSQL widensuc_credentials.credential_type(an ENUM, or a CHECK constraint on PostgreSQL) to the new values. Effect files come frombuild/sbt updateSchemaDumpson all three databases. An existing database takes the step throughbin/start-uc-server --upgrade-schema; Hibernate'supdatedoes not alter existing columns.UNIMPLEMENTEDin this PR; the next two PRs add it.CLI
bin/uc credential create|updategain--azure_directory_id,--azure_application_id,--azure_client_secret(must be given together) and--gcp_service_account_key_file <path>, which readsclient_email,private_key_idandprivate_keyfrom the key JSON file.Tests
BaseCredentialCRUDTest(SDK and CLI): create/get/list/update/delete for both new types, exactly-one-identity and blank-field validation, cloud cannot change on update.SdkCredentialCRUDTest.testGetAndListNeverReturnSecretsreads the raw HTTP responses and checks neitherclient_secretnor the private key appears.BaseExternalLocationCRUDTest.testExternalLocationCredentialMustMatchUrlCloud: scheme/cloud mismatch on create and update,file:accepts any.io.unitycatalog.server.migrate.*pass on H2, PostgreSQL 18 and MySQL 8.4 with the new step.server/testandcli/testpass locally.Compatibility
Additive API change; existing AWS credentials, the
aws_iam_rolefield and the legacy per-bucket configuration are unchanged. New validation: an AWS credential with a blankrole_arnis now rejected at create time (it could never vend).This pull request and its description were written by Isaac.