Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groups claim for oauth2 azuread applications #1650

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions _sub/security/azure-app-registration/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ resource "azuread_application" "app" {
required_resource_access,
]
}

group_membership_claims = var.groups_claim

}

resource "azuread_service_principal" "sp" {
Expand Down
13 changes: 13 additions & 0 deletions _sub/security/azure-app-registration/vars.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,17 @@ variable "api_permissions" {
scopes is a list of scopes to assign to the application. Example: ["email"]
Important note: If the permissions require admin consent, then you can use the azure-app-delegated-permissions-grant module to grant those permissions.
EOF
}

variable "groups_claim" {
type = list(string)
default = ["None"]
description = <<EOF
The groups claim issued in a user or OAuth 2.0 access token that the application expects.
Possible values are: "None", "SecurityGroup", "All", "DirectoryRole", "ApplicationGroup".
EOF
validation {
error_message = "One of the following values must be used: None, SecurityGroup, All, DirectoryRole, ApplicationGroup"
condition = alltrue([for value in var.groups_claim : contains(["None", "SecurityGroup", "All", "DirectoryRole", "ApplicationGroup"], value)])
}
}
Loading