Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

checkpoint

Daniel Hougaard83b74eec72bd
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 704078c21e..1768afeca3 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2779,6 +2779,11 @@ export const SecretSyncs = {
repo: "The name of the GitHub repository.",
env: "The name of the GitHub environment."
},
+ AZURE_ENTRA_ID_SCIM: {
+ servicePrincipalId:
+ "The Object ID of the Azure Entra ID Enterprise Application service principal to sync the SCIM token to.",
+ secretKey: "The key of the Infisical secret whose value will be used as the SCIM provisioning token."
+ },
AZURE_KEY_VAULT: {
vaultBaseUrl: "The base URL of the Azure Key Vault to sync secrets to. Example: https://example.vault.azure.net/",
tenantId: "The Tenant ID to use to connect with Azure Client Secrets.",
diff --git a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
index af42002ba4..be5cdca944 100644
--- a/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/app-connection-router.ts
@@ -37,6 +37,10 @@ import {
AzureDnsConnectionListItemSchema,
SanitizedAzureDnsConnectionSchema
} from "@app/services/app-connection/azure-dns/azure-dns-connection-schema";
+import {
+ AzureEntraIdConnectionListItemSchema,
+ SanitizedAzureEntraIdConnectionSchema
+} from "@app/services/app-connection/azure-entra-id";
import {
AzureKeyVaultConnectionListItemSchema,
SanitizedAzureKeyVaultConnectionSchema
@@ -206,7 +210,8 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedSmbConnectionSchema.options,
...SanitizedSshConnectionSchema.options,
...SanitizedDbtConnectionSchema.options,
- ...SanitizedOpenRouterConnectionSchema.options
+ ...SanitizedOpenRouterConnectionSchema.options,
+ ...SanitizedAzureEntraIdConnectionSchema.options
]);
const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
@@ -260,7 +265,8 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
SmbConnectionListItemSchema,
SshConnectionListItemSchema,
DbtConnectionListItemSchema,
- OpenRouterConnectionListItemSchema
+ OpenRouterConnectionListItemSchema,
+ AzureEntraIdConnectionListItemSchema
]);
export const registerAppConnectionRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/server/routes/v1/app-connection-routers/azure-entra-id-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/azure-entra-id-connection-router.ts
new file mode 100644
index 0000000000..33418d068f
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/azure-entra-id-connection-router.ts
@@ -0,0 +1,58 @@
+import { z } from "zod";
+
+import { readLimit } from "@app/server/config/rateLimiter";
+import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ CreateAzureEntraIdConnectionSchema,
+ SanitizedAzureEntraIdConnectionSchema,
+ UpdateAzureEntraIdConnectionSchema
+} from "@app/services/app-connection/azure-entra-id";
+import { AuthMode } from "@app/services/auth/auth-type";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerAzureEntraIdConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.AzureEntraId,
+ server,
+ sanitizedResponseSchema: SanitizedAzureEntraIdConnectionSchema,
+ createSchema: CreateAzureEntraIdConnectionSchema,
+ updateSchema: UpdateAzureEntraIdConnectionSchema
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/scim-service-principals`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listAzureEntraIdScimServicePrincipals",
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ querystring: z.object({
+ search: z.string().trim().optional()
+ }),
+ response: {
+ 200: z.object({
+ servicePrincipals: z.object({ id: z.string(), displayName: z.string(), appId: z.string() }).array()
+ })
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const { search } = req.query;
+
+ const servicePrincipals = await server.services.appConnection.azureEntraId.listScimServicePrincipals(
+ connectionId,
+ req.permission,
+ search
+ );
+
+ return { servicePrincipals };
+ }
+ });
+};
diff --git a/backend/src/server/routes/v1/app-connection-routers/index.ts b/backend/src/server/routes/v1/app-connection-routers/index.ts
index 43100d4cb4..00a71e74ad 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -11,6 +11,7 @@ import { registerAzureAppConfigurationConnectionRouter } from "./azure-app-confi
import { registerAzureClientSecretsConnectionRouter } from "./azure-client-secrets-connection-router";
import { registerAzureDevOpsConnectionRouter } from "./azure-devops-connection-router";
import { registerAzureDnsConnectionRouter } from "./azure-dns-connection-router";
+import { registerAzureEntraIdConnectionRouter } from "./azure-entra-id-connection-router";
import { registerAzureKeyVaultConnectionRouter } from "./azure-key-vault-connection-router";
import { registerBitbucketConnectionRouter } from "./bitbucket-connection-router";
import { registerCamundaConnectionRouter } from "./camunda-connection-router";
@@ -106,5 +107,6 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.Dbt]: registerDbtConnectionRouter,
[AppConnection.SMB]: registerSmbConnectionRouter,
[AppConnection.OpenRouter]: registerOpenRouterConnectionRouter,
- [AppConnection.CircleCI]: registerCircleCIConnectionRouter
+ [AppConnection.CircleCI]: registerCircleCIConnectionRouter,
+ [AppConnection.AzureEntraId]: registerAzureEntraIdConnectionRouter
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/azure-entra-id-scim-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/azure-entra-id-scim-sync-router.ts
new file mode 100644
index 0000000000..a52e52da83
--- /dev/null
+++ b/backend/src/server/routes/v1/secret-sync-routers/azure-entra-id-scim-sync-router.ts
@@ -0,0 +1,17 @@
+import {
+ AzureEntraIdScimSyncSchema,
+ CreateAzureEntraIdScimSyncSchema,
+ UpdateAzureEntraIdScimSyncSchema
+} from "@app/services/secret-sync/azure-entra-id-scim";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+
+import { registerSyncSecretsEndpoints } from "./secret-sync-endpoints";
+
+export const registerAzureEntraIdScimSyncRouter = async (server: FastifyZodProvider) =>
+ registerSyncSecretsEndpoints({
+ destination: SecretSync.AzureEntraIdScim,
+ server,
+ responseSchema: AzureEntraIdScimSyncSchema,
+ createSchema: CreateAzureEntraIdScimSyncSchema,
+ updateSchema: UpdateAzureEntraIdScimSyncSchema
+ });
diff --git a/backend/src/server/routes/v1/secret-sync-routers/index.ts b/backend/src/server/routes/v1/secret-sync-routers/index.ts
index 2cb04139dc..ec5452de2f 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/index.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/index.ts
@@ -7,6 +7,7 @@ import { registerAwsParameterStoreSyncRouter } from "./aws-parameter-store-sync-
import { registerAwsSecretsManagerSyncRouter } from "./aws-secrets-manager-sync-router";
import { registerAzureAppConfigurationSyncRouter } from "./azure-app-configuration-sync-router";
import { registerAzureDevOpsSyncRouter } from "./azure-devops-sync-router";
+import { registerAzureEntraIdScimSyncRouter } from "./azure-entra-id-scim-sync-router";
import { registerAzureKeyVaultSyncRouter } from "./azure-key-vault-sync-router";
import { registerBitbucketSyncRouter } from "./bitbucket-sync-router";
import { registerCamundaSyncRouter } from "./camunda-sync-router";
@@ -73,5 +74,6 @@ export const SECRET_SYNC_REGISTER_ROUTER_MAP: Record<SecretSync, (server: Fastif
[SecretSync.LaravelForge]: registerLaravelForgeSyncRouter,
[SecretSync.Chef]: registerChefSyncRouter,
[SecretSync.OctopusDeploy]: registerOctopusDeploySyncRouter,
- [SecretSync.CircleCI]: registerCircleCISyncRouter
+ [SecretSync.CircleCI]: registerCircleCISyncRouter,
+ [SecretSync.AzureEntraIdScim]: registerAzureEntraIdScimSyncRouter
};
diff --git a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
index 5fdbc21c0e..7fd28d2c3d 100644
--- a/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
+++ b/backend/src/server/routes/v1/secret-sync-routers/secret-sync-router.ts
@@ -21,6 +21,10 @@ import {
AzureAppConfigurationSyncSchema
} from "@app/services/secret-sync/azure-app-configuration";
import { AzureDevOpsSyncListItemSchema, AzureDevOpsSyncSchema } from "@app/services/secret-sync/azure-devops";
+import {
+ AzureEntraIdScimSyncListItemSchema,
+ AzureEntraIdScimSyncSchema
+} from "@app/services/secret-sync/azure-entra-id-scim";
import { AzureKeyVaultSyncListItemSchema, AzureKeyVaultSyncSchema } from "@app/services/secret-sync/azure-key-vault";
import { BitbucketSyncListItemSchema, BitbucketSyncSchema } from "@app/services/secret-sync/bitbucket";
import { CamundaSyncListItemSchema, CamundaSyncSchema } from "@app/services/secret-sync/camunda";
@@ -94,7 +98,8 @@ const SecretSyncSchema = z.discriminatedUnion("destination", [
LaravelForgeSyncSchema,
ChefSyncSchema,
OctopusDeploySyncSchema,
- CircleCISyncSchema
+ CircleCISyncSchema,
+ AzureEntraIdScimSyncSchema
]);
const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
@@ -132,7 +137,8 @@ const SecretSyncOptionsSchema = z.discriminatedUnion("destination", [
LaravelForgeSyncListItemSchema,
ChefSyncListItemSchema,
OctopusDeploySyncListItemSchema,
- CircleCISyncListItemSchema
+ CircleCISyncListItemSchema,
+ AzureEntraIdScimSyncListItemSchema
]);
export const registerSecretSyncRouter = async (server: FastifyZodProvider) => {
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 5d4570d735..db83f00b70 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -49,7 +49,8 @@ export enum AppConnection {
Dbt = "dbt",
SMB = "smb",
OpenRouter = "open-router",
- CircleCI = "circleci"
+ CircleCI = "circleci",
+ AzureEntraId = "azure-entra-id"
}
export enum AWSRegion {
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index fcc2d6ab87..c4ea3ac54b 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -66,6 +66,11 @@ import {
getAzureDnsConnectionListItem,
validateAzureDnsConnectionCredentials
} from "./azure-dns/azure-dns-connection-fns";
+import {
+ AzureEntraIdConnectionMethod,
+ getAzureEntraIdConnectionListItem,
+ validateAzureEntraIdConnectionCredentials
+} from "./azure-entra-id";
import {
AzureKeyVaultConnectionMethod,
getAzureKeyVaultConnectionListItem,
@@ -257,7 +262,8 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getDbtConnectionListItem(),
getSmbConnectionListItem(),
getOpenRouterConnectionListItem(),
- getCircleCIConnectionListItem()
+ getCircleCIConnectionListItem(),
+ getAzureEntraIdConnectionListItem()
]
.filter((option) => {
switch (projectType) {
@@ -398,7 +404,8 @@ export const validateAppConnectionCredentials = async (
[AppConnection.Dbt]: validateDbtConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.SMB]: validateSmbConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.OpenRouter]: validateOpenRouterConnectionCredentials as TAppConnectionCredentialsValidator,
- [AppConnection.CircleCI]: validateCircleCIConnectionCredentials as TAppConnectionCredentialsValidator
+ [AppConnection.CircleCI]: validateCircleCIConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.AzureEntraId]: validateAzureEntraIdConnectionCredentials as TAppConnectionCredentialsValidator
};
return VALIDATE_APP_CONNECTION_CREDENTIALS_MAP[appConnection.app](appConnection, gatewayService, gatewayV2Service);
@@ -449,6 +456,7 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
case DNSMadeEasyConnectionMethod.APIKeySecret:
return "API Key & Secret";
case AzureDnsConnectionMethod.ClientSecret:
+ case AzureEntraIdConnectionMethod.ClientSecret:
return "Client Secret";
case PostgresConnectionMethod.UsernameAndPassword:
case MsSqlConnectionMethod.UsernameAndPassword:
@@ -567,7 +575,8 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.Dbt]: platformManagedCredentialsNotSupported,
[AppConnection.SMB]: platformManagedCredentialsNotSupported,
[AppConnection.OpenRouter]: platformManagedCredentialsNotSupported,
- [AppConnection.CircleCI]: platformManagedCredentialsNotSupported
+ [AppConnection.CircleCI]: platformManagedCredentialsNotSupported,
+ [AppConnection.AzureEntraId]: platformManagedCredentialsNotSupported
};
export const enterpriseAppCheck = async (
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 367a108963..67a9008a21 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -51,7 +51,8 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.Dbt]: "DBT",
[AppConnection.SMB]: "SMB",
[AppConnection.OpenRouter]: "OpenRouter",
- [AppConnection.CircleCI]: "CircleCI"
+ [AppConnection.CircleCI]: "CircleCI",
+ [AppConnection.AzureEntraId]: "Azure Entra ID"
};
export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanType> = {
@@ -105,5 +106,6 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.Dbt]: AppConnectionPlanType.Regular,
[AppConnection.SMB]: AppConnectionPlanType.Regular,
[AppConnection.OpenRouter]: AppConnectionPlanType.Regular,
- [AppConnection.CircleCI]: AppConnectionPlanType.Regular
+ [AppConnection.CircleCI]: AppConnectionPlanType.Regular,
+ [AppConnection.AzureEntraId]: AppConnectionPlanType.Regular
};
diff --git a/backend/src/services/app-connection/app-connection-service.ts b/backend/src/services/app-connection/app-connection-service.ts
index aa50996063..70c3a68ef9 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -64,6 +64,8 @@ import { ValidateAzureDevOpsConnectionCredentialsSchema } from "./azure-devops/a
import { azureDevOpsConnectionService } from "./azure-devops/azure-devops-service";
import { ValidateAzureDnsConnectionCredentialsSchema } from "./azure-dns/azure-dns-connection-schema";
import { azureDnsConnectionService } from "./azure-dns/azure-dns-connection-service";
+import { ValidateAzureEntraIdConnectionCredentialsSchema } from "./azure-entra-id";
+import { azureEntraIdConnectionService } from "./azure-entra-id/azure-entra-id-connection-service";
import { ValidateAzureKeyVaultConnectionCredentialsSchema } from "./azure-key-vault";
import { ValidateBitbucketConnectionCredentialsSchema } from "./bitbucket";
import { bitbucketConnectionService } from "./bitbucket/bitbucket-connection-service";
@@ -200,7 +202,8 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.SSH]: ValidateSshConnectionCredentialsSchema,
[AppConnection.Dbt]: ValidateDbtConnectionCredentialsSchema,
[AppConnection.SMB]: ValidateSmbConnectionCredentialsSchema,
- [AppConnection.CircleCI]: ValidateCircleCIConnectionCredentialsSchema
+ [AppConnection.CircleCI]: ValidateCircleCIConnectionCredentialsSchema,
+ [AppConnection.AzureEntraId]: ValidateAzureEntraIdConnectionCredentialsSchema
};
export const appConnectionServiceFactory = ({
@@ -921,6 +924,7 @@ export const appConnectionServiceFactory = ({
chef: chefConnectionService(connectAppConnectionById, licenseService),
octopusDeploy: octopusDeployConnectionService(connectAppConnectionById),
dbt: dbtConnectionService(connectAppConnectionById),
- circleci: circleciConnectionService(connectAppConnectionById)
+ circleci: circleciConnectionService(connectAppConnectionById),
+ azureEntraId: azureEntraIdConnectionService(connectAppConnectionById, appConnectionDAL, kmsService)
};
};
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index f3c772e291..7eb051609e 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -70,6 +70,12 @@ import {
TAzureDnsConnectionInput,
TValidateAzureDnsConnectionCredentialsSchema
} from "./azure-dns/azure-dns-connection-types";
+import {
+ TAzureEntraIdConnection,
+ TAzureEntraIdConnectionConfig,
+ TAzureEntraIdConnectionInput,
+ TValidateAzureEntraIdConnectionCredentialsSchema
+} from "./azure-entra-id/azure-entra-id-connection-types";
import {
TAzureKeyVaultConnection,
TAzureKeyVaultConnectionConfig,
@@ -352,6 +358,7 @@ export type TAppConnection = { id: string } & (
| TSmbConnection
| TOpenRouterConnection
| TCircleCIConnection
+ | TAzureEntraIdConnection
);
export type TAppConnectionRaw = NonNullable<Awaited<ReturnType<TAppConnectionDALFactory["findById"]>>>;
@@ -410,6 +417,7 @@ export type TAppConnectionInput = { id: string } & (
| TSmbConnectionInput
| TOpenRouterConnectionInput
| TCircleCIConnectionInput
+ | TAzureEntraIdConnectionInput
);
export type TSqlConnectionInput =
@@ -485,7 +493,8 @@ export type TAppConnectionConfig =
| TDbtConnectionConfig
| TSmbConnectionConfig
| TOpenRouterConnectionConfig
- | TCircleCIConnectionConfig;
+ | TCircleCIConnectionConfig
+ | TAzureEntraIdConnectionConfig;
export type TValidateAppConnectionCredentialsSchema =
| TValidateAwsConnectionCredentialsSchema
@@ -538,7 +547,8 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateDbtConnectionCredentialsSchema
| TValidateSmbConnectionCredentialsSchema
| TValidateOpenRouterConnectionCredentialsSchema
- | TValidateCircleCIConnectionCredentialsSchema;
+ | TValidateCircleCIConnectionCredentialsSchema
+ | TValidateAzureEntraIdConnectionCredentialsSchema;
export type TListAwsConnectionKmsKeys = {
connectionId: string;
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-enums.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-enums.ts
new file mode 100644
index 0000000000..e287f06ede
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-enums.ts
@@ -0,0 +1,3 @@
+export enum AzureEntraIdConnectionMethod {
+ ClientSecret = "client-secret"
+}
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-fns.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-fns.ts
new file mode 100644
index 0000000000..1b6445b0cf
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-fns.ts
@@ -0,0 +1,146 @@
+import { AxiosError } from "axios";
+
+import { request } from "@app/lib/config/request";
+import { BadRequestError, InternalServerError, NotFoundError } from "@app/lib/errors";
+import {
+ decryptAppConnectionCredentials,
+ encryptAppConnectionCredentials
+} from "@app/services/app-connection/app-connection-fns";
+import { IntegrationUrls } from "@app/services/integration-auth/integration-list";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+
+import { TAppConnectionDALFactory } from "../app-connection-dal";
+import { AppConnection } from "../app-connection-enums";
+import { AzureEntraIdConnectionMethod } from "./azure-entra-id-connection-enums";
+import {
+ ExchangeCodeAzureResponse,
+ TAzureEntraIdConnectionClientSecretCredentials,
+ TAzureEntraIdConnectionConfig
+} from "./azure-entra-id-connection-types";
+
+export const getAzureEntraIdConnectionAccessToken = async (
+ connectionId: string,
+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">,
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">
+) => {
+ const appConnection = await appConnectionDAL.findById(connectionId);
+
+ if (!appConnection) {
+ throw new NotFoundError({ message: `Connection with ID '${connectionId}' not found` });
+ }
+
+ if (appConnection.app !== AppConnection.AzureEntraId) {
+ throw new BadRequestError({
+ message: `Connection with ID '${connectionId}' is not an Azure Entra ID connection`
+ });
+ }
+
+ const currentTime = Date.now();
+
+ switch (appConnection.method) {
+ case AzureEntraIdConnectionMethod.ClientSecret: {
+ const clientSecretCredentials = (await decryptAppConnectionCredentials({
+ orgId: appConnection.orgId,
+ kmsService,
+ encryptedCredentials: appConnection.encryptedCredentials,
+ projectId: appConnection.projectId
+ })) as TAzureEntraIdConnectionClientSecretCredentials;
+
+ const { accessToken, expiresAt, clientId, clientSecret, tenantId } = clientSecretCredentials;
+
+ // Check if token is still valid (with 5 minute buffer)
+ if (accessToken && expiresAt && expiresAt > currentTime + 300000) {
+ return accessToken;
+ }
+
+ const { data: clientData } = await request.post<ExchangeCodeAzureResponse>(
+ IntegrationUrls.AZURE_TOKEN_URL.replace("common", tenantId || "common"),
+ new URLSearchParams({
+ grant_type: "client_credentials",
+ scope: `https://graph.microsoft.com/.default`,
+ client_id: clientId,
+ client_secret: clientSecret
+ })
+ );
+
+ const updatedClientCredentials = {
+ ...clientSecretCredentials,
+ accessToken: clientData.access_token,
+ expiresAt: currentTime + clientData.expires_in * 1000
+ };
+
+ const encryptedClientCredentials = await encryptAppConnectionCredentials({
+ credentials: updatedClientCredentials,
+ orgId: appConnection.orgId,
+ kmsService,
+ projectId: appConnection.projectId
+ });
+
+ await appConnectionDAL.updateById(appConnection.id, { encryptedCredentials: encryptedClientCredentials });
+
+ return clientData.access_token;
+ }
+ default:
+ throw new InternalServerError({
+ message: `Unhandled Azure Entra ID connection method: ${appConnection.method as AzureEntraIdConnectionMethod}`
+ });
+ }
+};
+
+export const getAzureEntraIdConnectionListItem = () => {
+ return {
+ name: "Azure Entra ID" as const,
+ app: AppConnection.AzureEntraId as const,
+ methods: Object.values(AzureEntraIdConnectionMethod) as [AzureEntraIdConnectionMethod.ClientSecret]
+ };
+};
+
+export const validateAzureEntraIdConnectionCredentials = async (config: TAzureEntraIdConnectionConfig) => {
+ const { credentials: inputCredentials, method } = config;
+
+ switch (method) {
+ case AzureEntraIdConnectionMethod.ClientSecret: {
+ const { tenantId, clientId, clientSecret } = inputCredentials as {
+ tenantId: string;
+ clientId: string;
+ clientSecret: string;
+ };
+
+ try {
+ const { data: clientData } = await request.post<ExchangeCodeAzureResponse>(
+ IntegrationUrls.AZURE_TOKEN_URL.replace("common", tenantId || "common"),
+ new URLSearchParams({
+ grant_type: "client_credentials",
+ scope: `https://graph.microsoft.com/.default`,
+ client_id: clientId,
+ client_secret: clientSecret
+ })
+ );
+
+ return {
+ tenantId,
+ accessToken: clientData.access_token,
+ expiresAt: Date.now() + clientData.expires_in * 1000,
+ clientId,
+ clientSecret
+ };
+ } catch (e: unknown) {
+ if (e instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to get access token: ${
+ (e?.response?.data as { error_description?: string })?.error_description || "Unknown error"
+ }`
+ });
+ } else {
+ throw new InternalServerError({
+ message: "Failed to get access token"
+ });
+ }
+ }
+ }
+ default:
+ throw new InternalServerError({
+ message: `Unhandled Azure Entra ID connection method: ${method as AzureEntraIdConnectionMethod}`
+ });
+ }
+};
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-schemas.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-schemas.ts
new file mode 100644
index 0000000000..ca28d2e5b8
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-schemas.ts
@@ -0,0 +1,86 @@
+import { z } from "zod";
+
+import { AppConnections } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import {
+ BaseAppConnectionSchema,
+ GenericCreateAppConnectionFieldsSchema,
+ GenericUpdateAppConnectionFieldsSchema
+} from "@app/services/app-connection/app-connection-schemas";
+
+import { APP_CONNECTION_NAME_MAP } from "../app-connection-maps";
+import { AzureEntraIdConnectionMethod } from "./azure-entra-id-connection-enums";
+
+export const AzureEntraIdConnectionClientSecretInputCredentialsSchema = z.object({
+ clientId: z
+ .string()
+ .uuid()
+ .trim()
+ .min(1, "Client ID required")
+ .max(50, "Client ID must be at most 50 characters long"),
+ clientSecret: z.string().trim().min(1, "Client Secret required"),
+ tenantId: z.string().uuid().trim().min(1, "Tenant ID required")
+});
+
+export const AzureEntraIdConnectionClientSecretOutputCredentialsSchema = z.object({
+ clientId: z.string(),
+ clientSecret: z.string(),
+ tenantId: z.string(),
+ accessToken: z.string(),
+ expiresAt: z.number()
+});
+
+export const ValidateAzureEntraIdConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z
+ .literal(AzureEntraIdConnectionMethod.ClientSecret)
+ .describe(AppConnections.CREATE(AppConnection.AzureEntraId).method),
+ credentials: AzureEntraIdConnectionClientSecretInputCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.AzureEntraId).credentials
+ )
+ })
+]);
+
+export const CreateAzureEntraIdConnectionSchema = ValidateAzureEntraIdConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureEntraId)
+);
+
+export const UpdateAzureEntraIdConnectionSchema = z
+ .object({
+ credentials: AzureEntraIdConnectionClientSecretInputCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.AzureEntraId).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.AzureEntraId));
+
+const BaseAzureEntraIdConnectionSchema = BaseAppConnectionSchema.extend({
+ app: z.literal(AppConnection.AzureEntraId)
+});
+
+export const AzureEntraIdConnectionSchema = z.intersection(
+ BaseAzureEntraIdConnectionSchema,
+ z.discriminatedUnion("method", [
+ z.object({
+ method: z.literal(AzureEntraIdConnectionMethod.ClientSecret),
+ credentials: AzureEntraIdConnectionClientSecretOutputCredentialsSchema
+ })
+ ])
+);
+
+export const SanitizedAzureEntraIdConnectionSchema = z.discriminatedUnion("method", [
+ BaseAzureEntraIdConnectionSchema.extend({
+ method: z.literal(AzureEntraIdConnectionMethod.ClientSecret),
+ credentials: AzureEntraIdConnectionClientSecretOutputCredentialsSchema.pick({
+ clientId: true,
+ tenantId: true
+ })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.AzureEntraId]} (Client Secret)` }))
+]);
+
+export const AzureEntraIdConnectionListItemSchema = z
+ .object({
+ name: z.literal("Azure Entra ID"),
+ app: z.literal(AppConnection.AzureEntraId),
+ methods: z.nativeEnum(AzureEntraIdConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.AzureEntraId] }));
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts
new file mode 100644
index 0000000000..61eb0c1703
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-service.ts
@@ -0,0 +1,94 @@
+import { request } from "@app/lib/config/request";
+import { OrgServiceActor } from "@app/lib/types";
+import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { TAppConnection } from "@app/services/app-connection/app-connection-types";
+import { TKmsServiceFactory } from "@app/services/kms/kms-service";
+
+import { getAzureEntraIdConnectionAccessToken } from "./azure-entra-id-connection-fns";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TAppConnection>;
+
+type TAzureSyncJob = {
+ templateId: string;
+ schedule?: {
+ state?: string;
+ };
+};
+
+type TAzureSyncJobsResponse = {
+ value: TAzureSyncJob[];
+};
+
+type TAzureServicePrincipal = {
+ id: string;
+ displayName: string;
+ appId: string;
+};
+
+type TAzureServicePrincipalsResponse = {
+ value: TAzureServicePrincipal[];
+ "@odata.nextLink"?: string;
+};
+
+const SCIM_SERVICE_PRINCIPALS_LIMIT = 5;
+
+export const azureEntraIdConnectionService = (
+ getAppConnection: TGetAppConnectionFunc,
+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "update" | "updateById">,
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">
+) => {
+ const listScimServicePrincipals = async (connectionId: string, actor: OrgServiceActor, search?: string) => {
+ const appConnection = await getAppConnection(AppConnection.AzureEntraId, connectionId, actor);
+ const accessToken = await getAzureEntraIdConnectionAccessToken(appConnection.id, appConnectionDAL, kmsService);
+
+ const headers = {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ };
+
+ // Build the Graph API URL with optional search filter and limited page size
+ let url = `https://graph.microsoft.com/v1.0/servicePrincipals?$top=${SCIM_SERVICE_PRINCIPALS_LIMIT}&$select=id,displayName,appId`;
+
+ if (search) {
+ url += `&$filter=startswith(displayName,'${encodeURIComponent(search)}')`;
+ }
+
+ const { data }: { data: TAzureServicePrincipalsResponse } = await request.get(url, { headers });
+
+ // Filter to only those with SCIM synchronization jobs
+ const scimServicePrincipals: { id: string; displayName: string; appId: string }[] = [];
+
+ for (const sp of data.value) {
+ try {
+ // eslint-disable-next-line no-await-in-loop
+ const { data: jobsData } = await request.get<TAzureSyncJobsResponse>(
+ `https://graph.microsoft.com/v1.0/servicePrincipals/${sp.id}/synchronization/jobs`,
+ { headers }
+ );
+
+ const hasScimJob = jobsData.value.some((job) => job.templateId?.toLowerCase().includes("scim"));
+
+ if (hasScimJob) {
+ scimServicePrincipals.push({
+ id: sp.id,
+ displayName: sp.displayName,
+ appId: sp.appId
+ });
+ }
+ } catch {
+ // SP doesn't have synchronization configured, skip
+ }
+ }
+
+ return scimServicePrincipals;
+ };
+
+ return {
+ listScimServicePrincipals
+ };
+};
diff --git a/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-types.ts b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-types.ts
new file mode 100644
index 0000000000..8ea8938ae3
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/azure-entra-id-connection-types.ts
@@ -0,0 +1,38 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ AzureEntraIdConnectionClientSecretOutputCredentialsSchema,
+ AzureEntraIdConnectionSchema,
+ CreateAzureEntraIdConnectionSchema,
+ ValidateAzureEntraIdConnectionCredentialsSchema
+} from "./azure-entra-id-connection-schemas";
+
+export type TAzureEntraIdConnection = z.infer<typeof AzureEntraIdConnectionSchema>;
+
+export type TAzureEntraIdConnectionInput = z.infer<typeof CreateAzureEntraIdConnectionSchema> & {
+ app: AppConnection.AzureEntraId;
+};
+
+export type TValidateAzureEntraIdConnectionCredentialsSchema = typeof ValidateAzureEntraIdConnectionCredentialsSchema;
+
+export type TAzureEntraIdConnectionConfig = DiscriminativePick<
+ TAzureEntraIdConnectionInput,
+ "method" | "app" | "credentials"
+> & {
+ orgId: string;
+};
+
+export type ExchangeCodeAzureResponse = {
+ token_type: string;
+ scope: string;
+ expires_in: number;
+ ext_expires_in: number;
+ access_token: string;
+};
+
+export type TAzureEntraIdConnectionClientSecretCredentials = z.infer<
+ typeof AzureEntraIdConnectionClientSecretOutputCredentialsSchema
+>;
diff --git a/backend/src/services/app-connection/azure-entra-id/index.ts b/backend/src/services/app-connection/azure-entra-id/index.ts
new file mode 100644
index 0000000000..b3817e21dd
--- /dev/null
+++ b/backend/src/services/app-connection/azure-entra-id/index.ts
@@ -0,0 +1,4 @@
+export * from "./azure-entra-id-connection-enums";
+export * from "./azure-entra-id-connection-fns";
+export * from "./azure-entra-id-connection-schemas";
+export * from "./azure-entra-id-connection-types";
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts
new file mode 100644
index 0000000000..cabc46a388
--- /dev/null
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-constants.ts
@@ -0,0 +1,10 @@
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import { TSecretSyncListItem } from "@app/services/secret-sync/secret-sync-types";
+
+export const AZURE_ENTRA_ID_SCIM_SYNC_LIST_OPTION: TSecretSyncListItem = {
+ name: "Azure Entra ID SCIM",
+ destination: SecretSync.AzureEntraIdScim,
+ connection: AppConnection.AzureEntraId,
+ canImportSecrets: false
+};
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-fns.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-fns.ts
new file mode 100644
index 0000000000..b13de9a2a0
--- /dev/null
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-fns.ts
@@ -0,0 +1,59 @@
+import { request } from "@app/lib/config/request";
+import { SecretSyncError } from "@app/services/secret-sync/secret-sync-errors";
+import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";
+
+import { TAppConnectionDALFactory } from "../../app-connection/app-connection-dal";
+import { getAzureEntraIdConnectionAccessToken } from "../../app-connection/azure-entra-id/azure-entra-id-connection-fns";
+import { TKmsServiceFactory } from "../../kms/kms-service";
+import { TAzureEntraIdScimSyncWithCredentials } from "./azure-entra-id-scim-sync-types";
+
+type TAzureEntraIdScimSyncFactoryDeps = {
+ appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">;
+ kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;
+};
+
+export const AzureEntraIdScimSyncFns = {
+ syncSecrets: async (
+ secretSync: TAzureEntraIdScimSyncWithCredentials,
+ secretMap: TSecretMap,
+ { appConnectionDAL, kmsService }: TAzureEntraIdScimSyncFactoryDeps
+ ): Promise<void> => {
+ const { servicePrincipalId, secretKey } = secretSync.destinationConfig;
+
+ const secret = secretMap[secretKey];
+ if (!secret) {
+ throw new SecretSyncError({
+ error: new Error(`Secret "${secretKey}" not found in source`),
+ secretKey
+ });
+ }
+
+ const accessToken = await getAzureEntraIdConnectionAccessToken(
+ secretSync.connection.id,
+ appConnectionDAL,
+ kmsService
+ );
+
+ await request.put(
+ `https://graph.microsoft.com/v1.0/servicePrincipals/${servicePrincipalId}/synchronization/secrets`,
+ {
+ value: [{ key: "SecretToken", value: secret.value }]
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json"
+ }
+ }
+ );
+ },
+
+ getSecrets: async (): Promise<TSecretMap> => {
+ // Import is not supported for SCIM token sync
+ return {};
+ },
+
+ removeSecrets: async (): Promise<void> => {
+ // No-op: removing SCIM token is not supported
+ }
+};
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
new file mode 100644
index 0000000000..d3436ddb3e
--- /dev/null
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-schemas.ts
@@ -0,0 +1,61 @@
+import { z } from "zod";
+
+import { SecretSyncs } from "@app/lib/api-docs";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+import { SecretSync } from "@app/services/secret-sync/secret-sync-enums";
+import {
+ BaseSecretSyncSchema,
+ GenericCreateSecretSyncFieldsSchema,
+ GenericUpdateSecretSyncFieldsSchema
+} from "@app/services/secret-sync/secret-sync-schemas";
+import { TSyncOptionsConfig } from "@app/services/secret-sync/secret-sync-types";
+
+import { SECRET_SYNC_NAME_MAP } from "../secret-sync-maps";
+
+const AzureEntraIdScimSyncDestinationConfigSchema = z.object({
+ servicePrincipalId: z
+ .string()
+ .trim()
+ .min(1, "Service Principal ID required")
+ .describe(SecretSyncs.DESTINATION_CONFIG.AZURE_ENTRA_ID_SCIM.servicePrincipalId),
+ secretKey: z
+ .string()
+ .trim()
+ .min(1, "Secret key required")
+ .describe(SecretSyncs.DESTINATION_CONFIG.AZURE_ENTRA_ID_SCIM.secretKey)
+});
+
+const AzureEntraIdScimSyncOptionsConfig: TSyncOptionsConfig = { canImportSecrets: false };
+
+export const AzureEntraIdScimSyncSchema = BaseSecretSyncSchema(
+ SecretSync.AzureEntraIdScim,
+ AzureEntraIdScimSyncOptionsConfig
+)
+ .extend({
+ destination: z.literal(SecretSync.AzureEntraIdScim),
+ destinationConfig: AzureEntraIdScimSyncDestinationConfigSchema
+ })
+ .describe(JSON.stringify({ title: SECRET_SYNC_NAME_MAP[SecretSync.AzureEntraIdScim] }));
+
+export const CreateAzureEntraIdScimSyncSchema = GenericCreateSecretSyncFieldsSchema(
+ SecretSync.AzureEntraIdScim,
+ AzureEntraIdScimSyncOptionsConfig
+).extend({
+ destinationConfig: AzureEntraIdScimSyncDestinationConfigSchema
+});
+
+export const UpdateAzureEntraIdScimSyncSchema = GenericUpdateSecretSyncFieldsSchema(
+ SecretSync.AzureEntraIdScim,
+ AzureEntraIdScimSyncOptionsConfig
+).extend({
+ destinationConfig: AzureEntraIdScimSyncDestinationConfigSchema.optional()
+});
+
+export const AzureEntraIdScimSyncListItemSchema = z
+ .object({
+ name: z.literal("Azure Entra ID SCIM"),
+ connection: z.literal(AppConnection.AzureEntraId),
+ destination: z.literal(SecretSync.AzureEntraIdScim),
+ canImportSecrets: z.literal(false)
+ })
+ .describe(JSON.stringify({ title: SECRET_SYNC_NAME_MAP[SecretSync.AzureEntraIdScim] }));
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-types.ts b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-types.ts
new file mode 100644
index 0000000000..7a137536b8
--- /dev/null
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/azure-entra-id-scim-sync-types.ts
@@ -0,0 +1,19 @@
+import { z } from "zod";
+
+import { TAzureEntraIdConnection } from "@app/services/app-connection/azure-entra-id";
+
+import {
+ AzureEntraIdScimSyncListItemSchema,
+ AzureEntraIdScimSyncSchema,
+ CreateAzureEntraIdScimSyncSchema
+} from "./azure-entra-id-scim-sync-schemas";
+
+export type TAzureEntraIdScimSync = z.infer<typeof AzureEntraIdScimSyncSchema>;
+
+export type TAzureEntraIdScimSyncInput = z.infer<typeof CreateAzureEntraIdScimSyncSchema>;
+
+export type TAzureEntraIdScimSyncListItem = z.infer<typeof AzureEntraIdScimSyncListItemSchema>;
+
+export type TAzureEntraIdScimSyncWithCredentials = TAzureEntraIdScimSync & {
+ connection: TAzureEntraIdConnection;
+};
diff --git a/backend/src/services/secret-sync/azure-entra-id-scim/index.ts b/backend/src/services/secret-sync/azure-entra-id-scim/index.ts
new file mode 100644
index 0000000000..48cad21d48
--- /dev/null
+++ b/backend/src/services/secret-sync/azure-entra-id-scim/index.ts
@@ -0,0 +1,4 @@
+export * from "./azure-entra-id-scim-sync-constants";
+export * from "./azure-entra-id-scim-sync-fns";
+export * from "./azure-entra-id-scim-sync-schemas";
+export * from "./azure-entra-id-scim-sync-types";
diff --git a/backend/src/services/secret-sync/secret-sync-enums.ts b/backend/src/services/secret-sync/secret-sync-enums.ts
index cf4c178598..6d74c83201 100644
--- a/backend/src/services/secret-sync/secret-sync-enums.ts
+++ b/backend/src/services/secret-sync/secret-sync-enums.ts
@@ -33,7 +33,8 @@ export enum SecretSync {
LaravelForge = "laravel-forge",
Chef = "chef",
OctopusDeploy = "octopus-deploy",
- CircleCI = "circleci"
+ CircleCI = "circleci",
+ AzureEntraIdScim = "azure-entra-id-scim"
}
export enum SecretSyncInitialSyncBehavior {
diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.ts
index 41beb7b4a4..bf6408e059 100644
--- a/backend/src/services/secret-sync/secret-sync-fns.ts
+++ b/backend/src/services/secret-sync/secret-sync-fns.ts
@@ -31,6 +31,7 @@ import { ONEPASS_SYNC_LIST_OPTION, OnePassSyncFns } from "./1password";
import { AwsSecretsManagerSyncMappingBehavior } from "./aws-secrets-manager/aws-secrets-manager-sync-enums";
import { AZURE_APP_CONFIGURATION_SYNC_LIST_OPTION, azureAppConfigurationSyncFactory } from "./azure-app-configuration";
import { AZURE_DEVOPS_SYNC_LIST_OPTION, azureDevOpsSyncFactory } from "./azure-devops";
+import { AZURE_ENTRA_ID_SCIM_SYNC_LIST_OPTION, AzureEntraIdScimSyncFns } from "./azure-entra-id-scim";
import { AZURE_KEY_VAULT_SYNC_LIST_OPTION, azureKeyVaultSyncFactory } from "./azure-key-vault";
import { BITBUCKET_SYNC_LIST_OPTION, BitbucketSyncFns } from "./bitbucket";
import { CAMUNDA_SYNC_LIST_OPTION, camundaSyncFactory } from "./camunda";
@@ -102,7 +103,8 @@ const SECRET_SYNC_LIST_OPTIONS: Record<SecretSync, TSecretSyncListItem> = {
[SecretSync.LaravelForge]: LARAVEL_FORGE_SYNC_LIST_OPTION,
[SecretSync.Chef]: CHEF_SYNC_LIST_OPTION,
[SecretSync.OctopusDeploy]: OCTOPUS_DEPLOY_SYNC_LIST_OPTION,
- [SecretSync.CircleCI]: CIRCLECI_SYNC_LIST_OPTION
+ [SecretSync.CircleCI]: CIRCLECI_SYNC_LIST_OPTION,
+ [SecretSync.AzureEntraIdScim]: AZURE_ENTRA_ID_SCIM_SYNC_LIST_OPTION
};
export const listSecretSyncOptions = () => {
@@ -329,6 +331,8 @@ export const SecretSyncFns = {
return OctopusDeploySyncFns.syncSecrets(secretSync, schemaSecretMap);
case SecretSync.CircleCI:
return CircleCISyncFns.syncSecrets(secretSync, schemaSecretMap);
+ case SecretSync.AzureEntraIdScim:
+ return AzureEntraIdScimSyncFns.syncSecrets(secretSync, schemaSecretMap, { appConnectionDAL, kmsService });
default:
throw new Error(
`Unhandled sync destination for sync secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
@@ -463,6 +467,9 @@ export const SecretSyncFns = {
case SecretSync.CircleCI:
secretMap = await CircleCISyncFns.getSecrets(secretSync);
break;
+ case SecretSync.AzureEntraIdScim:
+ secretMap = await AzureEntraIdScimSyncFns.getSecrets();
+ break;
default:
throw new Error(
`Unhandled sync destination for get secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
@@ -566,6 +573,8 @@ export const SecretSyncFns = {
return OctopusDeploySyncFns.removeSecrets(secretSync, schemaSecretMap);
case SecretSync.CircleCI:
return CircleCISyncFns.removeSecrets(secretSync, schemaSecretMap);
+ case SecretSync.AzureEntraIdScim:
+ return AzureEntraIdScimSyncFns.removeSecrets();
default:
throw new Error(
`Unhandled sync destination for remove secrets fns: ${(secretSync as TSecretSyncWithCredentials).destination}`
diff --git a/backend/src/services/secret-sync/secret-sync-maps.ts b/backend/src/services/secret-sync/secret-sync-maps.ts
index c84ff34404..9b00111ca3 100644
--- a/backend/src/services/secret-sync/secret-sync-maps.ts
+++ b/backend/src/services/secret-sync/secret-sync-maps.ts
@@ -37,7 +37,8 @@ export const SECRET_SYNC_NAME_MAP: Record<SecretSync, string> = {
[SecretSync.LaravelForge]: "Laravel Forge",
[SecretSync.Chef]: "Chef",
[SecretSync.OctopusDeploy]: "Octopus Deploy",
- [SecretSync.CircleCI]: "CircleCI"
+ [SecretSync.CircleCI]: "CircleCI",
+ [SecretSync.AzureEntraIdScim]: "Azure Entra ID SCIM"
};
export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
@@ -75,7 +76,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.LaravelForge]: AppConnection.LaravelForge,
[SecretSync.Chef]: AppConnection.Chef,
[SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy,
- [SecretSync.CircleCI]: AppConnection.CircleCI
+ [SecretSync.CircleCI]: AppConnection.CircleCI,
+ [SecretSync.AzureEntraIdScim]: AppConnection.AzureEntraId
};
export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
@@ -113,7 +115,8 @@ export const SECRET_SYNC_PLAN_MAP: Record<SecretSync, SecretSyncPlanType> = {
[SecretSync.LaravelForge]: SecretSyncPlanType.Regular,
[SecretSync.Chef]: SecretSyncPlanType.Enterprise,
[SecretSync.OctopusDeploy]: SecretSyncPlanType.Regular,
- [SecretSync.CircleCI]: SecretSyncPlanType.Regular
+ [SecretSync.CircleCI]: SecretSyncPlanType.Regular,
+ [SecretSync.AzureEntraIdScim]: SecretSyncPlanType.Regular
};
export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
@@ -160,7 +163,8 @@ export const SECRET_SYNC_SKIP_FIELDS_MAP: Record<SecretSync, string[]> = {
[SecretSync.LaravelForge]: [],
[SecretSync.Chef]: [],
[SecretSync.OctopusDeploy]: [],
- [SecretSync.CircleCI]: []
+ [SecretSync.CircleCI]: [],
+ [SecretSync.AzureEntraIdScim]: []
};
const defaultDuplicateCheck: DestinationDuplicateCheckFn = () => true;
@@ -224,5 +228,6 @@ export const DESTINATION_DUPLICATE_CHECK_MAP: Record<SecretSync, DestinationDupl
[SecretSync.LaravelForge]: defaultDuplicateCheck,
[SecretSync.Chef]: defaultDuplicateCheck,
[SecretSync.OctopusDeploy]: defaultDuplicateCheck,
- [SecretSync.CircleCI]: defaultDuplicateCheck
+ [SecretSync.CircleCI]: defaultDuplicateCheck,
+ [SecretSync.AzureEntraIdScim]: defaultDuplicateCheck
};
diff --git a/backend/src/services/secret-sync/secret-sync-types.ts b/backend/src/services/secret-sync/secret-sync-types.ts
index af4ed92fa3..66ec8dcf3f 100644
--- a/backend/src/services/secret-sync/secret-sync-types.ts
+++ b/backend/src/services/secret-sync/secret-sync-types.ts
@@ -72,6 +72,12 @@ import {
TAzureDevOpsSyncListItem,
TAzureDevOpsSyncWithCredentials
} from "./azure-devops";
+import {
+ TAzureEntraIdScimSync,
+ TAzureEntraIdScimSyncInput,
+ TAzureEntraIdScimSyncListItem,
+ TAzureEntraIdScimSyncWithCredentials
+} from "./azure-entra-id-scim";
import {
TAzureKeyVaultSync,
TAzureKeyVaultSyncInput,
@@ -210,7 +216,8 @@ export type TSecretSync =
| TNorthflankSync
| TBitbucketSync
| TOctopusDeploySync
- | TCircleCISync;
+ | TCircleCISync
+ | TAzureEntraIdScimSync;
export type TSecretSyncWithCredentials =
| TAwsParameterStoreSyncWithCredentials
@@ -247,7 +254,8 @@ export type TSecretSyncWithCredentials =
| TBitbucketSyncWithCredentials
| TLaravelForgeSyncWithCredentials
| TOctopusDeploySyncWithCredentials
- | TCircleCISyncWithCredentials;
+ | TCircleCISyncWithCredentials
+ | TAzureEntraIdScimSyncWithCredentials;
export type TSecretSyncInput =
| TAwsParameterStoreSyncInput
@@ -284,7 +292,8 @@ export type TSecretSyncInput =
| TBitbucketSyncInput
| TLaravelForgeSyncInput
| TOctopusDeploySyncInput
- | TCircleCISyncInput;
+ | TCircleCISyncInput
+ | TAzureEntraIdScimSyncInput;
export type TSecretSyncListItem =
| TAwsParameterStoreSyncListItem
@@ -321,7 +330,8 @@ export type TSecretSyncListItem =
| TNorthflankSyncListItem
| TBitbucketSyncListItem
| TOctopusDeploySyncListItem
- | TCircleCISyncListItem;
+ | TCircleCISyncListItem
+ | TAzureEntraIdScimSyncListItem;
export type TSyncOptionsConfig = {
canImportSecrets: boolean;
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/AzureEntraIdScimSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/AzureEntraIdScimSyncFields.tsx
new file mode 100644
index 0000000000..7417318327
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/AzureEntraIdScimSyncFields.tsx
@@ -0,0 +1,102 @@
+import { useMemo, useState } from "react";
+import { Controller, useFormContext, useWatch } from "react-hook-form";
+
+import { SecretSyncConnectionField } from "@app/components/secret-syncs/forms/SecretSyncConnectionField";
+import { FilterableSelect, FormControl, Input } from "@app/components/v2";
+import {
+ TAzureScimServicePrincipal,
+ useAzureEntraIdConnectionListScimServicePrincipals
+} from "@app/hooks/api/appConnections/azure";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { useDebounce } from "@app/hooks/useDebounce";
+
+import { TSecretSyncForm } from "../schemas";
+
+export const AzureEntraIdScimSyncFields = () => {
+ const { control, setValue } = useFormContext<
+ TSecretSyncForm & { destination: SecretSync.AzureEntraIdScim }
+ >();
+
+ const connectionId = useWatch({ control, name: "connection.id" });
+
+ const [searchInput, setSearchInput] = useState("");
+ const [debouncedSearch] = useDebounce(searchInput, 300);
+ const [selectedSp, setSelectedSp] = useState<TAzureScimServicePrincipal | null>(null);
+
+ const { data: servicePrincipals, isLoading: isLoadingServicePrincipals } =
+ useAzureEntraIdConnectionListScimServicePrincipals(connectionId, debouncedSearch || undefined, {
+ enabled: Boolean(connectionId)
+ });
+
+ // Ensure the selected SP is always present in the options list
+ const options = useMemo(() => {
+ const results = servicePrincipals ?? [];
+ if (selectedSp && !results.some((sp) => sp.id === selectedSp.id)) {
+ return [selectedSp, ...results];
+ }
+ return results;
+ }, [servicePrincipals, selectedSp]);
+
+ return (
+ <>
+ <SecretSyncConnectionField
+ onChange={() => {
+ setValue("destinationConfig.servicePrincipalId", "");
+ setValue("destinationConfig.secretKey", "");
+ setSelectedSp(null);
+ }}
+ />
+
+ <Controller
+ name="destinationConfig.servicePrincipalId"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="SCIM Service Principal"
+ tooltipText="Select the Enterprise Application with SCIM provisioning configured. Type to search by name."
+ >
+ <FilterableSelect
+ value={options.find((sp) => sp.id === value) ?? null}
+ onChange={(option) => {
+ const selected = option as TAzureScimServicePrincipal | null;
+ setSelectedSp(selected);
+ onChange(selected?.id ?? "");
+ }}
+ onInputChange={(newValue) => setSearchInput(newValue)}
+ filterOption={null}
+ isLoading={isLoadingServicePrincipals}
+ options={options}
+ placeholder="Search for a SCIM service principal..."
+ getOptionLabel={(option) => option.displayName}
+ getOptionValue={(option) => option.id}
+ isClearable
+ isDisabled={!connectionId}
+ noOptionsMessage={() =>
+ debouncedSearch
+ ? "No matching service principals found"
+ : "Type to search for service principals"
+ }
+ />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="destinationConfig.secretKey"
+ control={control}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ isError={Boolean(error)}
+ errorText={error?.message}
+ label="Secret Key"
+ tooltipText="The key of the secret whose value will be used as the SCIM provisioning token."
+ >
+ <Input {...field} placeholder="SCIM_TOKEN" />
+ </FormControl>
+ )}
+ />
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
index 37e08cba0d..68f2c90def 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/SecretSyncDestinationFields.tsx
@@ -8,6 +8,7 @@ import { AwsParameterStoreSyncFields } from "./AwsParameterStoreSyncFields";
import { AwsSecretsManagerSyncFields } from "./AwsSecretsManagerSyncFields";
import { AzureAppConfigurationSyncFields } from "./AzureAppConfigurationSyncFields";
import { AzureDevOpsSyncFields } from "./AzureDevOpsSyncFields";
+import { AzureEntraIdScimSyncFields } from "./AzureEntraIdScimSyncFields";
import { AzureKeyVaultSyncFields } from "./AzureKeyVaultSyncFields";
import { BitbucketSyncFields } from "./BitbucketSyncFields";
import { CamundaSyncFields } from "./CamundaSyncFields";
@@ -115,6 +116,8 @@ export const SecretSyncDestinationFields = () => {
return <OctopusDeploySyncFields />;
case SecretSync.CircleCI:
return <CircleCISyncFields />;
+ case SecretSync.AzureEntraIdScim:
+ return <AzureEntraIdScimSyncFields />;
default:
throw new Error(`Unhandled Destination Config Field: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
index a7da5c2987..f824466590 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncOptionsFields/SecretSyncOptionsFields.tsx
@@ -81,6 +81,7 @@ export const SecretSyncOptionsFields = ({ hideInitialSync }: Props) => {
case SecretSync.Chef:
case SecretSync.OctopusDeploy:
case SecretSync.CircleCI:
+ case SecretSync.AzureEntraIdScim:
AdditionalSyncOptionsFieldsComponent = null;
break;
default:
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/AzureEntraIdScimSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/AzureEntraIdScimSyncReviewFields.tsx
new file mode 100644
index 0000000000..a14b4fa8c4
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/AzureEntraIdScimSyncReviewFields.tsx
@@ -0,0 +1,21 @@
+import { useFormContext } from "react-hook-form";
+
+import { GenericFieldLabel } from "@app/components/secret-syncs";
+import { TSecretSyncForm } from "@app/components/secret-syncs/forms/schemas";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+export const AzureEntraIdScimSyncReviewFields = () => {
+ const { watch } = useFormContext<
+ TSecretSyncForm & { destination: SecretSync.AzureEntraIdScim }
+ >();
+
+ const servicePrincipalId = watch("destinationConfig.servicePrincipalId");
+ const secretKey = watch("destinationConfig.secretKey");
+
+ return (
+ <>
+ <GenericFieldLabel label="Service Principal ID">{servicePrincipalId}</GenericFieldLabel>
+ <GenericFieldLabel label="Secret Key">{secretKey}</GenericFieldLabel>
+ </>
+ );
+};
diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
index 5544768249..68bd1cc528 100644
--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/SecretSyncReviewFields.tsx
@@ -20,6 +20,7 @@ import {
} from "./AwsSecretsManagerSyncReviewFields";
import { AzureAppConfigurationSyncReviewFields } from "./AzureAppConfigurationSyncReviewFields";
import { AzureDevOpsSyncReviewFields } from "./AzureDevOpsSyncReviewFields";
+import { AzureEntraIdScimSyncReviewFields } from "./AzureEntraIdScimSyncReviewFields";
import { AzureKeyVaultSyncReviewFields } from "./AzureKeyVaultSyncReviewFields";
import { BitbucketSyncReviewFields } from "./BitbucketSyncReviewFields";
import { CamundaSyncReviewFields } from "./CamundaSyncReviewFields";
@@ -190,6 +191,9 @@ export const SecretSyncReviewFields = () => {
case SecretSync.CircleCI:
DestinationFieldsComponent = <CircleCISyncReviewFields />;
break;
+ case SecretSync.AzureEntraIdScim:
+ DestinationFieldsComponent = <AzureEntraIdScimSyncReviewFields />;
+ break;
default:
throw new Error(`Unhandled Destination Review Fields: ${destination}`);
}
diff --git a/frontend/src/components/secret-syncs/forms/schemas/azure-entra-id-scim-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/azure-entra-id-scim-sync-destination-schema.ts
new file mode 100644
index 0000000000..1f6528f68d
--- /dev/null
+++ b/frontend/src/components/secret-syncs/forms/schemas/azure-entra-id-scim-sync-destination-schema.ts
@@ -0,0 +1,14 @@
+import { z } from "zod";
+
+import { BaseSecretSyncSchema } from "@app/components/secret-syncs/forms/schemas/base-secret-sync-schema";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+
+export const AzureEntraIdScimSyncDestinationSchema = BaseSecretSyncSchema().merge(
+ z.object({
+ destination: z.literal(SecretSync.AzureEntraIdScim),
+ destinationConfig: z.object({
+ servicePrincipalId: z.string().trim().min(1, "Service Principal ID required"),
+ secretKey: z.string().trim().min(1, "Secret key required")
+ })
+ })
+);
diff --git a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
index 7539aecab4..1b4110ef3c 100644
--- a/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
+++ b/frontend/src/components/secret-syncs/forms/schemas/secret-sync-schema.ts
@@ -5,6 +5,7 @@ import { AwsParameterStoreSyncDestinationSchema } from "./aws-parameter-store-sy
import { AwsSecretsManagerSyncDestinationSchema } from "./aws-secrets-manager-sync-destination-schema";
import { AzureAppConfigurationSyncDestinationSchema } from "./azure-app-configuration-sync-destination-schema";
import { AzureDevOpsSyncDestinationSchema } from "./azure-devops-sync-destination-schema";
+import { AzureEntraIdScimSyncDestinationSchema } from "./azure-entra-id-scim-sync-destination-schema";
import { AzureKeyVaultSyncDestinationSchema } from "./azure-key-vault-sync-destination-schema";
import { BitbucketSyncDestinationSchema } from "./bitbucket-sync-destination-schema";
import { CamundaSyncDestinationSchema } from "./camunda-sync-destination-schema";
@@ -71,7 +72,8 @@ const SecretSyncUnionSchema = z.discriminatedUnion("destination", [
BitbucketSyncDestinationSchema,
LaravelForgeSyncDestinationSchema,
ChefSyncDestinationSchema,
- CircleCISyncDestinationSchema
+ CircleCISyncDestinationSchema,
+ AzureEntraIdScimSyncDestinationSchema
]);
export const SecretSyncFormSchema = SecretSyncUnionSchema;
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index 3ccf7dfc4a..85f6770cc6 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -49,6 +49,7 @@ import {
ZabbixConnectionMethod
} from "@app/hooks/api/appConnections/types";
import { AzureDNSConnectionMethod } from "@app/hooks/api/appConnections/types/azure-dns-connection";
+import { AzureEntraIdConnectionMethod } from "@app/hooks/api/appConnections/types/azure-entra-id-connection";
import { BitbucketConnectionMethod } from "@app/hooks/api/appConnections/types/bitbucket-connection";
import { ChecklyConnectionMethod } from "@app/hooks/api/appConnections/types/checkly-connection";
import { ChefConnectionMethod } from "@app/hooks/api/appConnections/types/chef-connection";
@@ -150,7 +151,8 @@ export const APP_CONNECTION_MAP: Record<
[AppConnection.Dbt]: { name: "DBT", image: "DBT.png" },
[AppConnection.SMB]: { name: "SMB", image: "SMB.png", size: 50 },
[AppConnection.OpenRouter]: { name: "OpenRouter", image: "OpenRouter.png" },
- [AppConnection.CircleCI]: { name: "CircleCI", image: "CircleCI.png" }
+ [AppConnection.CircleCI]: { name: "CircleCI", image: "CircleCI.png" },
+ [AppConnection.AzureEntraId]: { name: "Azure Entra ID", image: "Microsoft Azure.png" }
};
export const getAppConnectionMethodDetails = (method: TAppConnection["method"]) => {
@@ -239,6 +241,7 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
case DNSMadeEasyConnectionMethod.APIKeySecret:
return { name: "API Key & Secret", icon: faKey };
case AzureDNSConnectionMethod.ClientSecret:
+ case AzureEntraIdConnectionMethod.ClientSecret:
return { name: "Client Secret", icon: faKey };
case OctopusDeployConnectionMethod.ApiKey:
return { name: "API Key", icon: faKey };
diff --git a/frontend/src/helpers/secretSyncs.ts b/frontend/src/helpers/secretSyncs.ts
index 82f2d76afa..3958c48348 100644
--- a/frontend/src/helpers/secretSyncs.ts
+++ b/frontend/src/helpers/secretSyncs.ts
@@ -133,6 +133,10 @@ export const SECRET_SYNC_MAP: Record<SecretSync, { name: string; image: string }
[SecretSync.CircleCI]: {
name: "CircleCI",
image: "CircleCI.png"
+ },
+ [SecretSync.AzureEntraIdScim]: {
+ name: "Azure Entra ID SCIM",
+ image: "Microsoft Azure.png"
}
};
@@ -171,7 +175,8 @@ export const SECRET_SYNC_CONNECTION_MAP: Record<SecretSync, AppConnection> = {
[SecretSync.LaravelForge]: AppConnection.LaravelForge,
[SecretSync.Chef]: AppConnection.Chef,
[SecretSync.OctopusDeploy]: AppConnection.OctopusDeploy,
- [SecretSync.CircleCI]: AppConnection.CircleCI
+ [SecretSync.CircleCI]: AppConnection.CircleCI,
+ [SecretSync.AzureEntraIdScim]: AppConnection.AzureEntraId
};
export const SECRET_SYNC_INITIAL_SYNC_BEHAVIOR_MAP: Record<
diff --git a/frontend/src/hooks/api/appConnections/azure/index.ts b/frontend/src/hooks/api/appConnections/azure/index.ts
index b69c251208..2c1906d369 100644
--- a/frontend/src/hooks/api/appConnections/azure/index.ts
+++ b/frontend/src/hooks/api/appConnections/azure/index.ts
@@ -1 +1,2 @@
export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/appConnections/azure/queries.tsx b/frontend/src/hooks/api/appConnections/azure/queries.tsx
index 8123806fd6..77e1c71668 100644
--- a/frontend/src/hooks/api/appConnections/azure/queries.tsx
+++ b/frontend/src/hooks/api/appConnections/azure/queries.tsx
@@ -3,14 +3,16 @@ import { useQuery, UseQueryOptions } from "@tanstack/react-query";
import { apiRequest } from "@app/config/request";
import { appConnectionKeys } from "../queries";
-import { AzureDevOpsProjectsResponse, TAzureClient } from "./types";
+import { AzureDevOpsProjectsResponse, TAzureClient, TAzureScimServicePrincipal } from "./types";
const azureConnectionKeys = {
all: [...appConnectionKeys.all, "azure"] as const,
listClients: (connectionId: string) =>
[...azureConnectionKeys.all, "clients", connectionId] as const,
listDevopsProjects: (connectionId: string) =>
- [...azureConnectionKeys.all, "devops-projects", connectionId] as const
+ [...azureConnectionKeys.all, "devops-projects", connectionId] as const,
+ listScimServicePrincipals: (connectionId: string, search?: string) =>
+ [...azureConnectionKeys.all, "scim-service-principals", connectionId, { search }] as const
};
export const useAzureConnectionListClients = (
@@ -63,3 +65,32 @@ export const useGetAzureDevOpsProjects = (
...options
});
};
+
+export const useAzureEntraIdConnectionListScimServicePrincipals = (
+ connectionId: string,
+ search?: string,
+ options?: Omit<
+ UseQueryOptions<
+ TAzureScimServicePrincipal[],
+ unknown,
+ TAzureScimServicePrincipal[],
+ ReturnType<typeof azureConnectionKeys.listScimServicePrincipals>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: azureConnectionKeys.listScimServicePrincipals(connectionId, search),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<{
+ servicePrincipals: TAzureScimServicePrincipal[];
+ }>(`/api/v1/app-connections/azure-entra-id/${connectionId}/scim-service-principals`, {
+ params: { search }
+ });
+
+ return data.servicePrincipals;
+ },
+ enabled: Boolean(connectionId),
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/azure/types.ts b/frontend/src/hooks/api/appConnections/azure/types.ts
index a5d21f047d..746070a3a1 100644
--- a/frontend/src/hooks/api/appConnections/azure/types.ts
+++ b/frontend/src/hooks/api/appConnections/azure/types.ts
@@ -13,3 +13,9 @@ export interface AzureDevOpsProject {
export interface AzureDevOpsProjectsResponse {
projects: AzureDevOpsProject[];
}
+
+export type TAzureScimServicePrincipal = {
+ id: string;
+ displayName: string;
+ appId: string;
+};
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index c7f18ec549..2bdff17b7c 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -49,5 +49,6 @@ export enum AppConnection {
Dbt = "dbt",
SMB = "smb",
OpenRouter = "open-router",
- CircleCI = "circleci"
+ CircleCI = "circleci",
+ AzureEntraId = "azure-entra-id"
}
diff --git a/frontend/src/hooks/api/appConnections/types/azure-entra-id-connection.ts b/frontend/src/hooks/api/appConnections/types/azure-entra-id-connection.ts
new file mode 100644
index 0000000000..fab615c5d5
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/azure-entra-id-connection.ts
@@ -0,0 +1,17 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum AzureEntraIdConnectionMethod {
+ ClientSecret = "client-secret"
+}
+
+export type TAzureEntraIdConnection = TRootAppConnection & {
+ app: AppConnection.AzureEntraId;
+} & {
+ method: AzureEntraIdConnectionMethod.ClientSecret;
+ credentials: {
+ clientId: string;
+ clientSecret: string;
+ tenantId: string;
+ };
+};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 7037507ce8..ed60d2f0c5 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -8,6 +8,7 @@ import { TAzureAppConfigurationConnection } from "./azure-app-configuration-conn
import { TAzureClientSecretsConnection } from "./azure-client-secrets-connection";
import { TAzureDevOpsConnection } from "./azure-devops-connection";
import { TAzureDNSConnection } from "./azure-dns-connection";
+import { TAzureEntraIdConnection } from "./azure-entra-id-connection";
import { TAzureKeyVaultConnection } from "./azure-key-vault-connection";
import { TBitbucketConnection } from "./bitbucket-connection";
import { TCamundaConnection } from "./camunda-connection";
@@ -60,6 +61,7 @@ export * from "./azure-app-configuration-connection";
export * from "./azure-client-secrets-connection";
export * from "./azure-devops-connection";
export * from "./azure-dns-connection";
+export * from "./azure-entra-id-connection";
export * from "./azure-key-vault-connection";
export * from "./bitbucket-connection";
export * from "./camunda-connection";
@@ -154,7 +156,8 @@ export type TAppConnection =
| TDbtConnection
| TSmbConnection
| TOpenRouterConnection
- | TCircleCIConnection;
+ | TCircleCIConnection
+ | TAzureEntraIdConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;
diff --git a/frontend/src/hooks/api/secretSyncs/enums.ts b/frontend/src/hooks/api/secretSyncs/enums.ts
index 835879914b..f28631eb31 100644
--- a/frontend/src/hooks/api/secretSyncs/enums.ts
+++ b/frontend/src/hooks/api/secretSyncs/enums.ts
@@ -33,7 +33,8 @@ export enum SecretSync {
LaravelForge = "laravel-forge",
Chef = "chef",
OctopusDeploy = "octopus-deploy",
- CircleCI = "circleci"
+ CircleCI = "circleci",
+ AzureEntraIdScim = "azure-entra-id-scim"
}
export enum SecretSyncStatus {
diff --git a/frontend/src/hooks/api/secretSyncs/types/azure-entra-id-scim-sync.ts b/frontend/src/hooks/api/secretSyncs/types/azure-entra-id-scim-sync.ts
new file mode 100644
index 0000000000..47971f9de4
--- /dev/null
+++ b/frontend/src/hooks/api/secretSyncs/types/azure-entra-id-scim-sync.ts
@@ -0,0 +1,16 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { SecretSync } from "@app/hooks/api/secretSyncs";
+import { TRootSecretSync } from "@app/hooks/api/secretSyncs/types/root-sync";
+
+export type TAzureEntraIdScimSync = TRootSecretSync & {
+ destination: SecretSync.AzureEntraIdScim;
+ destinationConfig: {
+ servicePrincipalId: string;
+ secretKey: string;
+ };
+ connection: {
+ app: AppConnection.AzureEntraId;
+ name: string;
+ id: string;
+ };
+};
diff --git a/frontend/src/hooks/api/secretSyncs/types/index.ts b/frontend/src/hooks/api/secretSyncs/types/index.ts
index fa81598a13..c65574dd9d 100644
--- a/frontend/src/hooks/api/secretSyncs/types/index.ts
+++ b/frontend/src/hooks/api/secretSyncs/types/index.ts
@@ -6,6 +6,7 @@ import { TAwsParameterStoreSync } from "./aws-parameter-store-sync";
import { TAwsSecretsManagerSync } from "./aws-secrets-manager-sync";
import { TAzureAppConfigurationSync } from "./azure-app-configuration-sync";
import { TAzureDevOpsSync } from "./azure-devops-sync";
+import { TAzureEntraIdScimSync } from "./azure-entra-id-scim-sync";
import { TAzureKeyVaultSync } from "./azure-key-vault-sync";
import { TBitbucketSync } from "./bitbucket-sync";
import { TCamundaSync } from "./camunda-sync";
@@ -79,7 +80,8 @@ export type TSecretSync =
| TLaravelForgeSync
| TChefSync
| TOctopusDeploySync
- | TCircleCISync;
+ | TCircleCISync
+ | TAzureEntraIdScimSync;
export type TListSecretSyncs = { secretSyncs: TSecretSync[] };
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
index 9ae492ed28..63bfdc7bbc 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -17,6 +17,7 @@ import { AzureAppConfigurationConnectionForm } from "./AzureAppConfigurationConn
import { AzureClientSecretsConnectionForm } from "./AzureClientSecretsConnectionForm";
import { AzureDevOpsConnectionForm } from "./AzureDevOpsConnectionForm";
import { AzureDNSConnectionForm } from "./AzureDNSConnectionForm";
+import { AzureEntraIdConnectionForm } from "./AzureEntraIdConnectionForm";
import { AzureKeyVaultConnectionForm } from "./AzureKeyVaultConnectionForm";
import { BitbucketConnectionForm } from "./BitbucketConnectionForm";
import { CamundaConnectionForm } from "./CamundaConnectionForm";
@@ -197,6 +198,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <OpenRouterConnectionForm onSubmit={onSubmit} />;
case AppConnection.CircleCI:
return <CircleCIConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.AzureEntraId:
+ return <AzureEntraIdConnectionForm onSubmit={onSubmit} />;
default:
throw new Error(`Unhandled App ${app}`);
}
@@ -371,6 +374,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <OpenRouterConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.CircleCI:
return <CircleCIConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.AzureEntraId:
+ return <AzureEntraIdConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
default:
throw new Error(`Unhandled App ${(appConnection as TAppConnection).app}`);
}
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx
new file mode 100644
index 0000000000..93e4326f07
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureEntraIdConnectionForm.tsx
@@ -0,0 +1,171 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import { Button, FormControl, Input, ModalClose, Select, SelectItem } from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import {
+ AzureEntraIdConnectionMethod,
+ TAzureEntraIdConnection
+} from "@app/hooks/api/appConnections/types/azure-entra-id-connection";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+const formSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.AzureEntraId),
+ method: z.literal(AzureEntraIdConnectionMethod.ClientSecret),
+ credentials: z.object({
+ tenantId: z.string().trim().min(1, "Tenant ID is required"),
+ clientId: z.string().trim().min(1, "Client ID is required"),
+ clientSecret: z.string().trim().min(1, "Client Secret is required")
+ })
+});
+
+type FormData = z.infer<typeof formSchema>;
+
+type Props = {
+ appConnection?: TAzureEntraIdConnection;
+ onSubmit: (formData: FormData) => Promise<void>;
+};
+
+export const AzureEntraIdConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection
+ ? {
+ name: appConnection.name,
+ description: appConnection.description,
+ app: AppConnection.AzureEntraId,
+ method: AzureEntraIdConnectionMethod.ClientSecret,
+ credentials: {
+ tenantId: appConnection.credentials.tenantId,
+ clientId: appConnection.credentials.clientId,
+ clientSecret: ""
+ }
+ }
+ : {
+ app: AppConnection.AzureEntraId,
+ method: AzureEntraIdConnectionMethod.ClientSecret,
+ credentials: {
+ tenantId: "",
+ clientId: "",
+ clientSecret: ""
+ }
+ }
+ });
+
+ const {
+ handleSubmit,
+ control,
+ formState: { isSubmitting, isDirty }
+ } = form;
+
+ return (
+ <FormProvider {...form}>
+ <form onSubmit={handleSubmit(onSubmit)}>
+ {!isUpdate && <GenericAppConnectionsFields />}
+
+ <Controller
+ name="method"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ tooltipText={`The method you would like to use to connect with ${
+ APP_CONNECTION_MAP[AppConnection.AzureEntraId].name
+ }. This field cannot be changed after creation.`}
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Method"
+ >
+ <Select
+ isDisabled={isUpdate}
+ value={value}
+ onValueChange={(val) => onChange(val)}
+ className="w-full border border-mineshaft-500"
+ position="popper"
+ dropdownContainerClassName="max-w-none"
+ >
+ {Object.values(AzureEntraIdConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="credentials.tenantId"
+ control={control}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ tooltipText="The Azure Active Directory (Entra ID) Tenant ID."
+ isError={Boolean(error?.message)}
+ label="Tenant ID"
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="00000000-0000-0000-0000-000000000000" />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="credentials.clientId"
+ control={control}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ tooltipText="The Application (Client) ID of the Azure App Registration."
+ isError={Boolean(error?.message)}
+ label="Client ID"
+ errorText={error?.message}
+ >
+ <Input {...field} placeholder="00000000-0000-0000-0000-000000000000" />
+ </FormControl>
+ )}
+ />
+
+ <Controller
+ name="credentials.clientSecret"
+ control={control}
+ render={({ field, fieldState: { error } }) => (
+ <FormControl
+ tooltipText="The client secret of the Azure App Registration."
+ isError={Boolean(error?.message)}
+ label="Client Secret"
+ errorText={error?.message}
+ >
+ <Input {...field} type="password" placeholder="~JzD8e6S.tH~w8XRaNnKcb7W1fM4rCns7FY" />
+ </FormControl>
+ )}
+ />
+
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || (!isUpdate && !isDirty)}
+ >
+ {isUpdate ? "Reconnect to Azure" : "Connect to Azure"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};