mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: add Microsoft Teams app tenant ID configuration
This commit is contained in:
@@ -455,6 +455,8 @@ export const MicrosoftTeamsAppClientId: string | null =
|
||||
process.env["MICROSOFT_TEAMS_APP_CLIENT_ID"] || null;
|
||||
export const MicrosoftTeamsAppClientSecret: string | null =
|
||||
process.env["MICROSOFT_TEAMS_APP_CLIENT_SECRET"] || null;
|
||||
export const MicrosoftTeamsAppTenantId: string | null =
|
||||
process.env["MICROSOFT_TEAMS_APP_TENANT_ID"] || null;
|
||||
|
||||
// VAPID Configuration for Web Push Notifications
|
||||
export const VapidPublicKey: string | undefined =
|
||||
|
||||
@@ -43,6 +43,7 @@ import OneUptimeDate from "../../../../Types/Date";
|
||||
import {
|
||||
MicrosoftTeamsAppClientId,
|
||||
MicrosoftTeamsAppClientSecret,
|
||||
MicrosoftTeamsAppTenantId,
|
||||
} from "../../../EnvironmentConfig";
|
||||
|
||||
// Import services for bot commands
|
||||
@@ -94,15 +95,17 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
||||
private static readonly WELCOME_CARD_STATE_KEY: string =
|
||||
"oneuptime.microsoftTeams.welcomeCardSent";
|
||||
// Get or create Bot Framework adapter for a specific tenant
|
||||
private static getBotAdapter(microsoftAppTenantId: string): CloudAdapter {
|
||||
private static getBotAdapter(): CloudAdapter {
|
||||
if (!MicrosoftTeamsAppClientId || !MicrosoftTeamsAppClientSecret) {
|
||||
throw new BadDataException(
|
||||
"Microsoft Teams App credentials not configured",
|
||||
);
|
||||
}
|
||||
|
||||
if (!microsoftAppTenantId) {
|
||||
throw new BadDataException("Microsoft Teams tenant ID is required");
|
||||
if (!MicrosoftTeamsAppTenantId) {
|
||||
throw new BadDataException(
|
||||
"Microsoft Teams app tenant ID is not configured",
|
||||
);
|
||||
}
|
||||
|
||||
logger.debug(
|
||||
@@ -110,13 +113,13 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
||||
);
|
||||
logger.debug(`App ID: ${MicrosoftTeamsAppClientId}`);
|
||||
logger.debug(`App Type: ${MICROSOFT_TEAMS_APP_TYPE}`);
|
||||
logger.debug(`Tenant ID: ${microsoftAppTenantId}`);
|
||||
logger.debug(`Tenant ID: ${MicrosoftTeamsAppTenantId}`);
|
||||
|
||||
const authConfig: ConfigurationBotFrameworkAuthenticationOptions = {
|
||||
MicrosoftAppId: MicrosoftTeamsAppClientId,
|
||||
MicrosoftAppPassword: MicrosoftTeamsAppClientSecret,
|
||||
MicrosoftAppType: MICROSOFT_TEAMS_APP_TYPE,
|
||||
MicrosoftAppTenantId: microsoftAppTenantId,
|
||||
MicrosoftAppTenantId: MicrosoftTeamsAppTenantId,
|
||||
};
|
||||
|
||||
const botFrameworkAuthentication: ConfigurationBotFrameworkAuthentication =
|
||||
@@ -1141,7 +1144,7 @@ export default class MicrosoftTeamsUtil extends WorkspaceBase {
|
||||
logger.debug(`Using bot ID: ${miscData.botId}`);
|
||||
|
||||
// Get Bot Framework adapter
|
||||
const adapter: CloudAdapter = this.getBotAdapter(tenantId);
|
||||
const adapter: CloudAdapter = this.getBotAdapter();
|
||||
|
||||
// Create conversation reference for the channel
|
||||
const conversationReference: ConversationReference = {
|
||||
@@ -2564,7 +2567,7 @@ All monitoring checks are passing normally.`;
|
||||
}
|
||||
|
||||
// Get Bot Framework adapter
|
||||
const adapter: CloudAdapter = this.getBotAdapter(tenantId);
|
||||
const adapter: CloudAdapter = this.getBotAdapter();
|
||||
|
||||
// Create custom activity handler class that extends TeamsActivityHandler
|
||||
class OneUptimeTeamsActivityHandler extends TeamsActivityHandler {
|
||||
|
||||
@@ -87,6 +87,7 @@ If you are using Docker Compose then,
|
||||
\`\`\`bash
|
||||
MICROSOFT_TEAMS_APP_CLIENT_ID=YOUR_TEAMS_APP_CLIENT_ID
|
||||
MICROSOFT_TEAMS_APP_CLIENT_SECRET=YOUR_TEAMS_APP_CLIENT_SECRET
|
||||
MICROSOFT_TEAMS_APP_TENANT_ID=YOUR_MICROSOFT_TENANT_ID
|
||||
\`\`\`
|
||||
|
||||
If you are using Kubernetes with Helm then, add these to your \`values.yaml\` file
|
||||
@@ -95,6 +96,7 @@ If you are using Kubernetes with Helm then, add these to your \`values.yaml\` fi
|
||||
microsoftTeamsApp:
|
||||
clientId:
|
||||
clientSecret:
|
||||
tenantId:
|
||||
\`\`\`
|
||||
|
||||
|
||||
|
||||
@@ -86,6 +86,7 @@ If you are using Docker Compose, add these environment variables to your configu
|
||||
```bash
|
||||
MICROSOFT_TEAMS_APP_CLIENT_ID=YOUR_TEAMS_APP_CLIENT_ID
|
||||
MICROSOFT_TEAMS_APP_CLIENT_SECRET=YOUR_TEAMS_APP_CLIENT_SECRET
|
||||
MICROSOFT_TEAMS_APP_TENANT_ID=YOUR_MICROSOFT_TENANT_ID
|
||||
```
|
||||
|
||||
#### Kubernetes with Helm
|
||||
@@ -96,6 +97,7 @@ If you are using Kubernetes with Helm, add these to your `values.yaml` file:
|
||||
microsoftTeamsApp:
|
||||
clientId: YOUR_TEAMS_APP_CLIENT_ID
|
||||
clientSecret: YOUR_TEAMS_APP_CLIENT_SECRET
|
||||
tenantId: YOUR_MICROSOFT_TENANT_ID
|
||||
```
|
||||
|
||||
**Important:** Restart your OneUptime server after adding these environment variables so they take effect.
|
||||
|
||||
@@ -40,6 +40,8 @@ Usage:
|
||||
value: {{ (ternary "true" "false" $isEnterpriseEdition) | squote }}
|
||||
- name: MICROSOFT_TEAMS_APP_CLIENT_ID
|
||||
value: {{ $.Values.microsoftTeamsApp.clientId }}
|
||||
- name: MICROSOFT_TEAMS_APP_TENANT_ID
|
||||
value: {{ $.Values.microsoftTeamsApp.tenantId }}
|
||||
|
||||
{{- if $.Values.openTelemetryExporter.endpoint }}
|
||||
- name: OPENTELEMETRY_EXPORTER_OTLP_ENDPOINT
|
||||
|
||||
@@ -2004,6 +2004,9 @@
|
||||
},
|
||||
"clientSecret": {
|
||||
"type": ["string", "null"]
|
||||
},
|
||||
"tenantId": {
|
||||
"type": ["string", "null"]
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
|
||||
@@ -795,6 +795,7 @@ slackApp:
|
||||
microsoftTeamsApp:
|
||||
clientId:
|
||||
clientSecret:
|
||||
tenantId:
|
||||
|
||||
keda:
|
||||
enabled: true
|
||||
|
||||
@@ -355,4 +355,5 @@ NGINX_LISTEN_OPTIONS=
|
||||
# IMPORTANT: Use the SECRET VALUE, not the SECRET ID from Azure App Registration
|
||||
# The secret value is typically longer and includes more characters
|
||||
MICROSOFT_TEAMS_APP_CLIENT_ID=
|
||||
MICROSOFT_TEAMS_APP_CLIENT_SECRET=
|
||||
MICROSOFT_TEAMS_APP_CLIENT_SECRET=
|
||||
MICROSOFT_TEAMS_APP_TENANT_ID=
|
||||
@@ -72,6 +72,7 @@ x-common-variables: &common-variables
|
||||
|
||||
|
||||
MICROSOFT_TEAMS_APP_CLIENT_ID: ${MICROSOFT_TEAMS_APP_CLIENT_ID}
|
||||
MICROSOFT_TEAMS_APP_TENANT_ID: ${MICROSOFT_TEAMS_APP_TENANT_ID}
|
||||
|
||||
x-common-runtime-variables: &common-runtime-variables
|
||||
<<: *common-variables
|
||||
|
||||
Reference in New Issue
Block a user