Skip to main content
Creates a new credential, which is a record that contains authentication information required to connect to a resource outside the database. Any user may create a credential for their own use.
CREATE CREDENTIAL Syntax
  • TYPE is case-insensitive.
  • Only the TYPE name is checked when the credential is created; whether it is appropriate is checked where the credential is used.
  • When a credential is used to authenticate a catalog, a SECRET given directly takes precedence over a token supplied in WITH OPTIONS.
For the syntax of each authentication scheme, see Provider-Specific Syntax below. For runnable examples of every one, see Creating Credentials in the Snippets section.
The following can make use of credentials: The following services are supported:
  • Azure (Microsoft blob storage)
  • GCS (Google Cloud Storage)
  • HDFS (Apache Hadoop Distributed File System)
  • JDBC (Java Database Connectivity, using a user-supplied driver or one of the drivers on the supported list)
  • Kafka (streaming feed)
    • Apache
    • Confluent
  • Remote Repositories
    • Docker
    • Nvidia
    • OpenAI
  • S3 (Amazon S3 Bucket)

Parameters

OR REPLACE

Any existing credential with the same name will be dropped before creating this one

<schema name>

Name of the schema that will contain the created credential; if no schema is specified, the credential will be created in the user’s default schema

<credential name>

Name of the credential to create; must adhere to the supported naming criteria

TYPE

The type of credential to create. Supported types include:
TypeDescription
aws_access_keyAuthenticate to Amazon Web Services (AWS) via Access Key
aws_iam_roleAuthenticate to Amazon Web Services (AWS) via IAM Role
azure_adAuthenticate to Microsoft Azure via Active Directory
azure_oauthAuthenticate to Microsoft Azure via OAuth
azure_sasAuthenticate to Microsoft Azure via Shared Access Signature (SAS) using an account-level access token, not a container-level one
azure_storage_keyAuthenticate to Microsoft Azure via Storage Key
confluentAuthenticate to a Confluent Kafka cluster or schema registry
dockerAuthenticate to a Docker repository
gcs_service_account_idAuthenticate to Google Cloud via user ID & private key
gcs_service_account_keysAuthenticate to Google Cloud via JSON key
hdfsAuthenticate to HDFS
jdbcAuthenticate via Java Database Connectivity
kafkaAuthenticate to an Apache Kafka cluster or schema registry
nvidia_api_keyAuthenticate to the Nvidia AI API
openai_api_keyAuthenticate to the OpenAI API
restREST / OAuth bearer-token authentication for data lake catalog endpoints

IDENTITY

Optional username to use for authenticating with the credential. Its meaning depends on the credential TYPE; for rest, an IDENTITY & SECRET together form an OAuth client-credentials pair, while a SECRET alone is a bearer token.

SECRET

Optional password to use for authenticating with the credential.

WITH OPTIONS

Optional indicator that a comma-delimited list of option/value assignments will follow. See Options for the full list of options.

Examples

To create a credential, auser_azure_active_dir_creds, for connecting to Microsoft Azure Active Directory:
CREATE CREDENTIAL (Azure AD) Example
To create a credential, kafka_cred, for connecting to Apache Kafka via SSL:
CREATE CREDENTIAL (Kafka SSL) Example

Options

The following is a list of possible credential options and their associated providers. For valid combinations of credential options per provider and authentication mechanism, see Provider-Specific Syntax.

Provider-Specific Syntax

Several authentication schemes across multiple providers are supported.
Each form below links to a runnable example. For all of them in one place, see Creating Credentials in the Snippets section.

Azure

Syntax below, examples here.

Data Lake Catalog

Syntax below, examples here. Used to authenticate data lake catalogs; a SECRET alone is a bearer token, while an IDENTITY & SECRET together form an OAuth client-credentials pair.

GCS

Syntax below, examples here.

HDFS

Syntax below, examples here.

JDBC

Syntax below, examples here.
Password

Kafka (Apache)

Syntax below, examples here.

Kafka (Confluent)

Syntax below, examples here.

Remote Repository

Syntax below, examples here.

S3

Syntax below, examples here.