1. Packages
  2. Databricks Provider
  3. API Docs
  4. ServicePrincipalSecret
Databricks v1.67.0 published on Thursday, Apr 17, 2025 by Pulumi

databricks.ServicePrincipalSecret

Explore with Pulumi AI

This resource can only be used with an account-level provider.

With this resource you can create a secret for a given Service Principals.

This secret can be used to configure the Databricks Pulumi Provider to authenticate with the service principal. See Authenticating with service principal.

Additionally, the secret can be used to request OAuth tokens for the service principal, which can be used to authenticate to Databricks REST APIs. See Authentication using OAuth tokens for service principals.

Example Usage

Create service principal secret

import * as pulumi from "@pulumi/pulumi";
import * as databricks from "@pulumi/databricks";

const terraformSp = new databricks.ServicePrincipalSecret("terraform_sp", {servicePrincipalId: _this.id});
Copy
import pulumi
import pulumi_databricks as databricks

terraform_sp = databricks.ServicePrincipalSecret("terraform_sp", service_principal_id=this["id"])
Copy
package main

import (
	"github.com/pulumi/pulumi-databricks/sdk/go/databricks"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := databricks.NewServicePrincipalSecret(ctx, "terraform_sp", &databricks.ServicePrincipalSecretArgs{
			ServicePrincipalId: pulumi.Any(this.Id),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Databricks = Pulumi.Databricks;

return await Deployment.RunAsync(() => 
{
    var terraformSp = new Databricks.ServicePrincipalSecret("terraform_sp", new()
    {
        ServicePrincipalId = @this.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.databricks.ServicePrincipalSecret;
import com.pulumi.databricks.ServicePrincipalSecretArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var terraformSp = new ServicePrincipalSecret("terraformSp", ServicePrincipalSecretArgs.builder()
            .servicePrincipalId(this_.id())
            .build());

    }
}
Copy
resources:
  terraformSp:
    type: databricks:ServicePrincipalSecret
    name: terraform_sp
    properties:
      servicePrincipalId: ${this.id}
Copy

The following resources are often used in the same context:

Create ServicePrincipalSecret Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ServicePrincipalSecret(name: string, args: ServicePrincipalSecretArgs, opts?: CustomResourceOptions);
@overload
def ServicePrincipalSecret(resource_name: str,
                           args: ServicePrincipalSecretArgs,
                           opts: Optional[ResourceOptions] = None)

@overload
def ServicePrincipalSecret(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           service_principal_id: Optional[str] = None,
                           create_time: Optional[str] = None,
                           expire_time: Optional[str] = None,
                           lifetime: Optional[str] = None,
                           secret: Optional[str] = None,
                           secret_hash: Optional[str] = None,
                           status: Optional[str] = None,
                           update_time: Optional[str] = None)
func NewServicePrincipalSecret(ctx *Context, name string, args ServicePrincipalSecretArgs, opts ...ResourceOption) (*ServicePrincipalSecret, error)
public ServicePrincipalSecret(string name, ServicePrincipalSecretArgs args, CustomResourceOptions? opts = null)
public ServicePrincipalSecret(String name, ServicePrincipalSecretArgs args)
public ServicePrincipalSecret(String name, ServicePrincipalSecretArgs args, CustomResourceOptions options)
type: databricks:ServicePrincipalSecret
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServicePrincipalSecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServicePrincipalSecretArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServicePrincipalSecretArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServicePrincipalSecretArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServicePrincipalSecretArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var servicePrincipalSecretResource = new Databricks.ServicePrincipalSecret("servicePrincipalSecretResource", new()
{
    ServicePrincipalId = "string",
    CreateTime = "string",
    ExpireTime = "string",
    Lifetime = "string",
    Secret = "string",
    SecretHash = "string",
    Status = "string",
    UpdateTime = "string",
});
Copy
example, err := databricks.NewServicePrincipalSecret(ctx, "servicePrincipalSecretResource", &databricks.ServicePrincipalSecretArgs{
	ServicePrincipalId: pulumi.String("string"),
	CreateTime:         pulumi.String("string"),
	ExpireTime:         pulumi.String("string"),
	Lifetime:           pulumi.String("string"),
	Secret:             pulumi.String("string"),
	SecretHash:         pulumi.String("string"),
	Status:             pulumi.String("string"),
	UpdateTime:         pulumi.String("string"),
})
Copy
var servicePrincipalSecretResource = new ServicePrincipalSecret("servicePrincipalSecretResource", ServicePrincipalSecretArgs.builder()
    .servicePrincipalId("string")
    .createTime("string")
    .expireTime("string")
    .lifetime("string")
    .secret("string")
    .secretHash("string")
    .status("string")
    .updateTime("string")
    .build());
Copy
service_principal_secret_resource = databricks.ServicePrincipalSecret("servicePrincipalSecretResource",
    service_principal_id="string",
    create_time="string",
    expire_time="string",
    lifetime="string",
    secret="string",
    secret_hash="string",
    status="string",
    update_time="string")
Copy
const servicePrincipalSecretResource = new databricks.ServicePrincipalSecret("servicePrincipalSecretResource", {
    servicePrincipalId: "string",
    createTime: "string",
    expireTime: "string",
    lifetime: "string",
    secret: "string",
    secretHash: "string",
    status: "string",
    updateTime: "string",
});
Copy
type: databricks:ServicePrincipalSecret
properties:
    createTime: string
    expireTime: string
    lifetime: string
    secret: string
    secretHash: string
    servicePrincipalId: string
    status: string
    updateTime: string
Copy

ServicePrincipalSecret Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ServicePrincipalSecret resource accepts the following input properties:

ServicePrincipalId
This property is required.
Changes to this property will trigger replacement.
string
SCIM ID of the databricks.ServicePrincipal (not application ID).
CreateTime string
UTC time when the secret was created.
ExpireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
Lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
Secret string
Generated secret for the service principal.
SecretHash string
Secret Hash.
Status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
UpdateTime string
UTC time when the secret was updated.
ServicePrincipalId
This property is required.
Changes to this property will trigger replacement.
string
SCIM ID of the databricks.ServicePrincipal (not application ID).
CreateTime string
UTC time when the secret was created.
ExpireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
Lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
Secret string
Generated secret for the service principal.
SecretHash string
Secret Hash.
Status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
UpdateTime string
UTC time when the secret was updated.
servicePrincipalId
This property is required.
Changes to this property will trigger replacement.
String
SCIM ID of the databricks.ServicePrincipal (not application ID).
createTime String
UTC time when the secret was created.
expireTime String
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. String
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret String
Generated secret for the service principal.
secretHash String
Secret Hash.
status String
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime String
UTC time when the secret was updated.
servicePrincipalId
This property is required.
Changes to this property will trigger replacement.
string
SCIM ID of the databricks.ServicePrincipal (not application ID).
createTime string
UTC time when the secret was created.
expireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret string
Generated secret for the service principal.
secretHash string
Secret Hash.
status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime string
UTC time when the secret was updated.
service_principal_id
This property is required.
Changes to this property will trigger replacement.
str
SCIM ID of the databricks.ServicePrincipal (not application ID).
create_time str
UTC time when the secret was created.
expire_time str
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. str
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret str
Generated secret for the service principal.
secret_hash str
Secret Hash.
status str
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
update_time str
UTC time when the secret was updated.
servicePrincipalId
This property is required.
Changes to this property will trigger replacement.
String
SCIM ID of the databricks.ServicePrincipal (not application ID).
createTime String
UTC time when the secret was created.
expireTime String
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. String
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret String
Generated secret for the service principal.
secretHash String
Secret Hash.
status String
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime String
UTC time when the secret was updated.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServicePrincipalSecret resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ServicePrincipalSecret Resource

Get an existing ServicePrincipalSecret resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ServicePrincipalSecretState, opts?: CustomResourceOptions): ServicePrincipalSecret
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        expire_time: Optional[str] = None,
        lifetime: Optional[str] = None,
        secret: Optional[str] = None,
        secret_hash: Optional[str] = None,
        service_principal_id: Optional[str] = None,
        status: Optional[str] = None,
        update_time: Optional[str] = None) -> ServicePrincipalSecret
func GetServicePrincipalSecret(ctx *Context, name string, id IDInput, state *ServicePrincipalSecretState, opts ...ResourceOption) (*ServicePrincipalSecret, error)
public static ServicePrincipalSecret Get(string name, Input<string> id, ServicePrincipalSecretState? state, CustomResourceOptions? opts = null)
public static ServicePrincipalSecret get(String name, Output<String> id, ServicePrincipalSecretState state, CustomResourceOptions options)
resources:  _:    type: databricks:ServicePrincipalSecret    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
CreateTime string
UTC time when the secret was created.
ExpireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
Lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
Secret string
Generated secret for the service principal.
SecretHash string
Secret Hash.
ServicePrincipalId Changes to this property will trigger replacement. string
SCIM ID of the databricks.ServicePrincipal (not application ID).
Status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
UpdateTime string
UTC time when the secret was updated.
CreateTime string
UTC time when the secret was created.
ExpireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
Lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
Secret string
Generated secret for the service principal.
SecretHash string
Secret Hash.
ServicePrincipalId Changes to this property will trigger replacement. string
SCIM ID of the databricks.ServicePrincipal (not application ID).
Status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
UpdateTime string
UTC time when the secret was updated.
createTime String
UTC time when the secret was created.
expireTime String
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. String
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret String
Generated secret for the service principal.
secretHash String
Secret Hash.
servicePrincipalId Changes to this property will trigger replacement. String
SCIM ID of the databricks.ServicePrincipal (not application ID).
status String
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime String
UTC time when the secret was updated.
createTime string
UTC time when the secret was created.
expireTime string
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. string
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret string
Generated secret for the service principal.
secretHash string
Secret Hash.
servicePrincipalId Changes to this property will trigger replacement. string
SCIM ID of the databricks.ServicePrincipal (not application ID).
status string
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime string
UTC time when the secret was updated.
create_time str
UTC time when the secret was created.
expire_time str
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. str
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret str
Generated secret for the service principal.
secret_hash str
Secret Hash.
service_principal_id Changes to this property will trigger replacement. str
SCIM ID of the databricks.ServicePrincipal (not application ID).
status str
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
update_time str
UTC time when the secret was updated.
createTime String
UTC time when the secret was created.
expireTime String
UTC time when the secret will expire. If the field is not present, the secret does not expire.
lifetime Changes to this property will trigger replacement. String
The lifetime of the secret in seconds formatted as NNNNs. If this parameter is not provided, the secret will have a default lifetime of 730 days (63072000s). Expiration of secret will lead to generation of new secret.
secret String
Generated secret for the service principal.
secretHash String
Secret Hash.
servicePrincipalId Changes to this property will trigger replacement. String
SCIM ID of the databricks.ServicePrincipal (not application ID).
status String
Status of the secret (i.e., ACTIVE - see REST API docs for full list).
updateTime String
UTC time when the secret was updated.

Package Details

Repository
databricks pulumi/pulumi-databricks
License
Apache-2.0
Notes
This Pulumi package is based on the databricks Terraform Provider.