Skip to content

Commit

Permalink
Add oauth config for bot
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinbuss committed Sep 17, 2024
1 parent a8024c6 commit ebf5b62
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
15 changes: 15 additions & 0 deletions code/infra/botservice.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,18 @@ module "bot_service" {
private_dns_zone_id_bot_framework_token = var.private_dns_zone_id_bot_framework_token
customer_managed_key = local.customer_managed_key
}

resource "azurerm_bot_connection" "bot_connection_aad" {
name = "aad"
bot_name = reverse(split(module.bot_service.bot_service_id, "/"))[0]
location = var.location
resource_group_name = azurerm_resource_group.resource_group.name

client_id = var.bot_oauth_client_id
client_secret = var.bot_oauth_client_secret
parameters = {
"TenantId" = data.azurerm_client_config.current.tenant_id
}
service_provider_name = "Azure Active Directory v2" # serviceProviderId = "30dd229c-58e3-4a48-bdfd-91ec48eb906c"
scopes = join(" ", var.bot_oauth_scopes)
}
2 changes: 2 additions & 0 deletions code/infra/data.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
data "azurerm_client_config" "current" {}

data "azurerm_virtual_network" "virtual_network" {
name = local.virtual_network.name
resource_group_name = local.virtual_network.resource_group_name
Expand Down
20 changes: 19 additions & 1 deletion code/infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,29 @@ variable "tags" {

# Service variables
variable "web_app_app_settings" {
description = "Specifies the videoindexer id"
description = "Specifies the web app settings."
type = map(string)
sensitive = false
}

variable "bot_oauth_client_id" {
description = "Specifies the client id of the Entra ID oauth app."
type = string
sensitive = true
}

variable "bot_oauth_client_secret" {
description = "Specifies the client secret of the Entra ID oauth app."
type = string
sensitive = true
}

variable "bot_oauth_scopes" {
description = "Specifies the scopes of the Entra ID oauth app."
type = list(string)
sensitive = false
}

# Logging variables
variable "log_analytics_workspace_id" {
description = "Specifies the resource ID of the log analytics workspace used for collecting logs."
Expand Down
10 changes: 9 additions & 1 deletion config/PerfectThymeTech/vars.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,15 @@ tags = {
}

# Service variables
web_app_app_settings = {}
web_app_app_settings = {}
bot_oauth_client_id = ""
bot_oauth_client_secret = ""
bot_oauth_scopes = [
"openid",
"profile",
"User.Read",
"User.ReadBasic.All",
]

# Logging variables
log_analytics_workspace_id = "/subscriptions/8f171ff9-2b5b-4f0f-aed5-7fa360a1d094/resourceGroups/DefaultResourceGroup-NEU/providers/Microsoft.OperationalInsights/workspaces/DefaultWorkspace-8f171ff9-2b5b-4f0f-aed5-7fa360a1d094-NEU"
Expand Down

0 comments on commit ebf5b62

Please sign in to comment.