|
| 1 | +--- |
| 2 | +subcategory: "Security" |
| 3 | +--- |
| 4 | + |
| 5 | +# databricks_service_principal Data Source |
| 6 | + |
| 7 | +-> **Note** If you have a fully automated setup with workspaces created by [databricks_mws_workspaces](../resources/mws_workspaces.md) or [azurerm_databricks_workspace](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/databricks_workspace), please make sure to add [depends_on attribute](../index.md#data-resources-and-authentication-is-not-configured-errors) in order to prevent _authentication is not configured for provider_ errors. |
| 8 | + |
| 9 | +Retrieves information about [databricks_service_principal](../resources/service_principal.md). |
| 10 | + |
| 11 | +## Example Usage |
| 12 | + |
| 13 | +Adding service principal `11111111-2222-3333-4444-555666777888` to administrative group |
| 14 | + |
| 15 | +```hcl |
| 16 | +data "databricks_group" "admins" { |
| 17 | + display_name = "admins" |
| 18 | +} |
| 19 | +
|
| 20 | +data "databricks_service_principal" "spn" { |
| 21 | + application_id = "11111111-2222-3333-4444-555666777888" |
| 22 | +} |
| 23 | +
|
| 24 | +resource "databricks_group_member" "my_member_a" { |
| 25 | + group_id = data.databricks_group.admins.id |
| 26 | + member_id = data.databricks_service_principal.spn.id |
| 27 | +} |
| 28 | +``` |
| 29 | + |
| 30 | +## Argument Reference |
| 31 | + |
| 32 | +Data source allows you to pick service principals by the following attributes |
| 33 | + |
| 34 | +- `application_id` - (Required) ID of the service principal. The service principal must exist before this resource can be retrieved. |
| 35 | + |
| 36 | +## Attribute Reference |
| 37 | + |
| 38 | +Data source exposes the following attributes: |
| 39 | + |
| 40 | +- `sp_id` - The id of the service principal. |
| 41 | +- `external_id` - ID of the service principal in an external identity provider. |
| 42 | +- `display_name` - Display name of the [service principal](../resources/service_principal.md), e.g. `Foo SPN`. |
| 43 | +- `home` - Home folder of the [service principal](../resources/service_principal.md), e.g. `/Users/11111111-2222-3333-4444-555666777888`. |
| 44 | +- `repos` - Repos location of the [service principal](../resources/service_principal.md), e.g. `/Repos/11111111-2222-3333-4444-555666777888`. |
| 45 | +- `active` - Whether service principal is active or not. |
| 46 | + |
| 47 | +## Related Resources |
| 48 | + |
| 49 | +The following resources are used in the same context: |
| 50 | + |
| 51 | +* [End to end workspace management](../guides/passthrough-cluster-per-user.md) guide |
| 52 | +* [databricks_current_user](current_user.md) data to retrieve information about [databricks_user](../resources/user.md) or [databricks_service_principal](../resources/service_principal.md), that is calling Databricks REST API. |
| 53 | +* [databricks_group](../resources/group.md) to manage [groups in Databricks Workspace](https://docs.databricks.com/administration-guide/users-groups/groups.html) or [Account Console](https://accounts.cloud.databricks.com/) (for AWS deployments). |
| 54 | +* [databricks_group](group.md) data to retrieve information about [databricks_group](../resources/group.md) members, entitlements and instance profiles. |
| 55 | +* [databricks_group_instance_profile](../resources/group_instance_profile.md) to attach [databricks_instance_profile](../resources/instance_profile.md) (AWS) to [databricks_group](../resources/group.md). |
| 56 | +* [databricks_group_member](../resources/group_member.md) to attach [users](../resources/user.md) and [groups](../resources/group.md) as group members. |
| 57 | +* [databricks_permissions](../resources/permissions.md) to manage [access control](https://docs.databricks.com/security/access-control/index.html) in Databricks workspace. |
| 58 | +* [databricks_service principal](../resources/service_principal.md) to manage [service principals](../resources/service_principal.md) |
0 commit comments