# Validate Storage Credential

Launch stage: GA

`POST /api/2.1/unity-catalog/validate-storage-credentials`

Validates a storage credential.
 At least one of __external_location_name__ and __url__ need to be provided. If only one of them is
 provided, it will be used for validation. And if both are provided, the __url__ will be used for
 validation, and __external_location_name__ will be ignored when checking overlapping urls.

 Either the __storage_credential_name__ or the cloud-specific credential must be provided.

 The caller must be a metastore admin or the storage credential owner or
 have the **CREATE_EXTERNAL_LOCATION** privilege on the metastore and the storage credential.

API scopes: unity-catalog

## Request body

- `storage_credential_name` (string, required)
  Required. The name of an existing credential or long-lived cloud
   credential to validate.
- `aws_iam_role` (object, required)
  The AWS IAM role configuration.
  - `role_arn` (string, optional)
    The Amazon Resource Name (ARN) of the AWS IAM role used to vend temporary credentials.
  - `unity_catalog_iam_arn` (string, optional)
    The Amazon Resource Name (ARN) of the AWS IAM user managed by <Databricks>.
     This is the identity that is going to assume the AWS IAM role.
  - `external_id` (string, optional)
    The external ID used in role assumption to prevent the confused deputy problem.
- `azure_service_principal` (object, required)
  The Azure service principal configuration.
  - `directory_id` (string, optional)
    The directory ID corresponding to the Azure Active Directory (AAD) tenant of the application.
  - `application_id` (string, optional)
    The application ID of the application registration within the referenced AAD tenant.
  - `client_secret` (string, optional)
    The client secret generated for the above app ID in AAD.
- `azure_managed_identity` (object, required)
  The Azure managed identity configuration.
  - `access_connector_id` (string, optional)
    The Azure resource ID of the Azure Databricks Access Connector. Use the format
     `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.Databricks/accessConnectors/{connector-name}`.
  - `managed_identity_id` (string, optional)
    The Azure resource ID of the managed identity. Use the format,
     `/subscriptions/{guid}/resourceGroups/{rg-name}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identity-name}`
     This is only available for user-assgined identities. For system-assigned identities, the access_connector_id is used to identify the identity.
     If this field is not provided, then we assume the AzureManagedIdentity is using the system-assigned identity.
  - `credential_id` (string, optional)
    The <Databricks> internal ID that represents this managed identity.
- `databricks_gcp_service_account` (object, required)
  The <Databricks> created GCP service account configuration.
  - `email` (string, optional)
    The email of the service account.
  - `private_key_id` (string, optional)
    The ID that represents the private key for this Service Account
  - `credential_id` (string, optional)
    The <Databricks> internal ID that represents this managed identity.
- `external_location_name` (string, optional)
  The name of an existing external location to validate.
- `url` (string, optional)
  The external location url to validate.
- `read_only` (boolean, optional)
  Whether the storage credential is only usable for read operations.

## Returns

- `isDir` (boolean, optional)
  Whether the tested location is a directory in cloud storage.
- `results` (array of object, optional)
  The results of the validation check.
  - `operation` (string, optional)
    The operation tested.
    Possible values: `LIST`, `READ`, `WRITE`, `DELETE`, `PATH_EXISTS`
  - `result` (string, optional)
    The results of the tested operation.
    Possible values: `PASS`, `FAIL`, `SKIP`
  - `message` (string, optional)
    Error message would exist when the result does not equal to **PASS**.

## Response

```json
{
  "isDir": true,
  "results": [
    {
      "operation": "string",
      "result": "string",
      "message": "string"
    }
  ]
}
```

