Configure Unity Catalog storage account for CORS

You must configure cross-origin resource sharing (CORS) for Databricks to upload files efficiently to managed volumes defined in Unity Catalog.

You can configure CORS settings during initial deployment of your Unity Catalog metastore storage or change these settings later. Only sufficiently privileged cloud administrators can apply these changes. The instructions that follow assume that you have proper credentials and are logged into the cloud console for the account containing your storage account.

Configure CORS settings for Google Cloud Storage

  1. Create a JSON file with the following configuration:

    [
       {
       "origin": ["https://*.gcp.databricks.com"],
       "method": ["GET"],
       "responseHeader": ["Content-Type"],
       "maxAgeSeconds": 3600
       }
    ]
    
  2. From the gcloud CLI, run the storage buckets update command with the --cors-file flag:

    gcloud storage buckets update gs://<bucket-name> --cors-file=<cors-config-file>
    

    Where:

    • <bucket-name> is the name of your bucket. For example, my-bucket.

    • <cors-config-file> is the path to the JSON file you created in Step 1.

For more information, see the [Google Cloud documentation]https://cloud.google.com/storage/docs/