Skip to content

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

Add Azure DNS as a provider for ACME

Carlos Monastyrskieb92807629c3
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 e65dc88946..c150e97e0d 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
@@ -33,6 +33,10 @@ import {
AzureDevOpsConnectionListItemSchema,
SanitizedAzureDevOpsConnectionSchema
} from "@app/services/app-connection/azure-devops/azure-devops-schemas";
+import {
+ AzureDnsConnectionListItemSchema,
+ SanitizedAzureDnsConnectionSchema
+} from "@app/services/app-connection/azure-dns/azure-dns-connection-schema";
import {
AzureKeyVaultConnectionListItemSchema,
SanitizedAzureKeyVaultConnectionSchema
@@ -186,6 +190,7 @@ const SanitizedAppConnectionSchema = z.union([
...SanitizedLaravelForgeConnectionSchema.options,
...SanitizedChefConnectionSchema.options,
...SanitizedDNSMadeEasyConnectionSchema.options,
+ ...SanitizedAzureDnsConnectionSchema.options,
...SanitizedOctopusDeployConnectionSchema.options,
...SanitizedSshConnectionSchema.options
]);
@@ -235,6 +240,7 @@ const AppConnectionOptionsSchema = z.discriminatedUnion("app", [
LaravelForgeConnectionListItemSchema,
ChefConnectionListItemSchema,
DNSMadeEasyConnectionListItemSchema,
+ AzureDnsConnectionListItemSchema,
OctopusDeployConnectionListItemSchema,
SshConnectionListItemSchema
]);
diff --git a/backend/src/server/routes/v1/app-connection-routers/azure-dns-connection-router.ts b/backend/src/server/routes/v1/app-connection-routers/azure-dns-connection-router.ts
new file mode 100644
index 0000000000..a411e235dc
--- /dev/null
+++ b/backend/src/server/routes/v1/app-connection-routers/azure-dns-connection-router.ts
@@ -0,0 +1,51 @@
+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 {
+ CreateAzureDnsConnectionSchema,
+ SanitizedAzureDnsConnectionSchema,
+ UpdateAzureDnsConnectionSchema
+} from "@app/services/app-connection/azure-dns/azure-dns-connection-schema";
+import { AuthMode } from "@app/services/auth/auth-type";
+
+import { registerAppConnectionEndpoints } from "./app-connection-endpoints";
+
+export const registerAzureDnsConnectionRouter = async (server: FastifyZodProvider) => {
+ registerAppConnectionEndpoints({
+ app: AppConnection.AzureDNS,
+ server,
+ sanitizedResponseSchema: SanitizedAzureDnsConnectionSchema,
+ createSchema: CreateAzureDnsConnectionSchema,
+ updateSchema: UpdateAzureDnsConnectionSchema
+ });
+
+ server.route({
+ method: "GET",
+ url: `/:connectionId/azure-dns-zones`,
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ operationId: "listAzureDnsZones",
+ params: z.object({
+ connectionId: z.string().uuid()
+ }),
+ response: {
+ 200: z
+ .object({
+ id: z.string(),
+ name: z.string()
+ })
+ .array()
+ }
+ },
+ onRequest: verifyAuth([AuthMode.JWT]),
+ handler: async (req) => {
+ const { connectionId } = req.params;
+ const zones = await server.services.appConnection.azureDns.listZones(connectionId, req.permission);
+ return zones;
+ }
+ });
+};
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 6a1ad4ad97..dd5779746c 100644
--- a/backend/src/server/routes/v1/app-connection-routers/index.ts
+++ b/backend/src/server/routes/v1/app-connection-routers/index.ts
@@ -10,6 +10,7 @@ import { registerAzureADCSConnectionRouter } from "./azure-adcs-connection-route
import { registerAzureAppConfigurationConnectionRouter } from "./azure-app-configuration-connection-router";
import { registerAzureClientSecretsConnectionRouter } from "./azure-client-secrets-connection-router";
import { registerAzureDevOpsConnectionRouter } from "./azure-devops-connection-router";
+import { registerAzureDnsConnectionRouter } from "./azure-dns-connection-router";
import { registerAzureKeyVaultConnectionRouter } from "./azure-key-vault-connection-router";
import { registerBitbucketConnectionRouter } from "./bitbucket-connection-router";
import { registerCamundaConnectionRouter } from "./camunda-connection-router";
@@ -60,6 +61,7 @@ export const APP_CONNECTION_REGISTER_ROUTER_MAP: Record<AppConnection, (server:
[AppConnection.AzureClientSecrets]: registerAzureClientSecretsConnectionRouter,
[AppConnection.AzureDevOps]: registerAzureDevOpsConnectionRouter,
[AppConnection.AzureADCS]: registerAzureADCSConnectionRouter,
+ [AppConnection.AzureDNS]: registerAzureDnsConnectionRouter,
[AppConnection.Databricks]: registerDatabricksConnectionRouter,
[AppConnection.Humanitec]: registerHumanitecConnectionRouter,
[AppConnection.TerraformCloud]: registerTerraformCloudConnectionRouter,
diff --git a/backend/src/services/app-connection/app-connection-enums.ts b/backend/src/services/app-connection/app-connection-enums.ts
index 3474914220..dcec588b3d 100644
--- a/backend/src/services/app-connection/app-connection-enums.ts
+++ b/backend/src/services/app-connection/app-connection-enums.ts
@@ -9,6 +9,7 @@ export enum AppConnection {
AzureClientSecrets = "azure-client-secrets",
AzureDevOps = "azure-devops",
AzureADCS = "azure-adcs",
+ AzureDNS = "azure-dns",
Humanitec = "humanitec",
TerraformCloud = "terraform-cloud",
Vercel = "vercel",
diff --git a/backend/src/services/app-connection/app-connection-fns.ts b/backend/src/services/app-connection/app-connection-fns.ts
index 2b9ce06e75..7a76bbe08c 100644
--- a/backend/src/services/app-connection/app-connection-fns.ts
+++ b/backend/src/services/app-connection/app-connection-fns.ts
@@ -61,6 +61,11 @@ import {
getAzureDevopsConnectionListItem,
validateAzureDevOpsConnectionCredentials
} from "./azure-devops/azure-devops-fns";
+import { AzureDnsConnectionMethod } from "./azure-dns/azure-dns-connection-enum";
+import {
+ getAzureDnsConnectionListItem,
+ validateAzureDnsConnectionCredentials
+} from "./azure-dns/azure-dns-connection-fns";
import {
AzureKeyVaultConnectionMethod,
getAzureKeyVaultConnectionListItem,
@@ -184,7 +189,8 @@ const PKI_APP_CONNECTIONS = [
AppConnection.AzureADCS,
AppConnection.AzureKeyVault,
AppConnection.Chef,
- AppConnection.DNSMadeEasy
+ AppConnection.DNSMadeEasy,
+ AppConnection.AzureDNS
];
export const listAppConnectionOptions = (projectType?: ProjectType) => {
@@ -222,6 +228,7 @@ export const listAppConnectionOptions = (projectType?: ProjectType) => {
getGitLabConnectionListItem(),
getCloudflareConnectionListItem(),
getDNSMadeEasyConnectionListItem(),
+ getAzureDnsConnectionListItem(),
getZabbixConnectionListItem(),
getRailwayConnectionListItem(),
getBitbucketConnectionListItem(),
@@ -357,6 +364,7 @@ export const validateAppConnectionCredentials = async (
[AppConnection.GitLab]: validateGitLabConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Cloudflare]: validateCloudflareConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.DNSMadeEasy]: validateDNSMadeEasyConnectionCredentials as TAppConnectionCredentialsValidator,
+ [AppConnection.AzureDNS]: validateAzureDnsConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Zabbix]: validateZabbixConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Railway]: validateRailwayConnectionCredentials as TAppConnectionCredentialsValidator,
[AppConnection.Bitbucket]: validateBitbucketConnectionCredentials as TAppConnectionCredentialsValidator,
@@ -418,6 +426,8 @@ export const getAppConnectionMethodName = (method: TAppConnection["method"]) =>
return "API Token";
case DNSMadeEasyConnectionMethod.APIKeySecret:
return "API Key & Secret";
+ case AzureDnsConnectionMethod.ClientSecret:
+ return "Client Secret";
case PostgresConnectionMethod.UsernameAndPassword:
case MsSqlConnectionMethod.UsernameAndPassword:
case MySqlConnectionMethod.UsernameAndPassword:
@@ -513,6 +523,7 @@ export const TRANSITION_CONNECTION_CREDENTIALS_TO_PLATFORM: Record<
[AppConnection.GitLab]: platformManagedCredentialsNotSupported,
[AppConnection.Cloudflare]: platformManagedCredentialsNotSupported,
[AppConnection.DNSMadeEasy]: platformManagedCredentialsNotSupported,
+ [AppConnection.AzureDNS]: platformManagedCredentialsNotSupported,
[AppConnection.Zabbix]: platformManagedCredentialsNotSupported,
[AppConnection.Railway]: platformManagedCredentialsNotSupported,
[AppConnection.Bitbucket]: platformManagedCredentialsNotSupported,
diff --git a/backend/src/services/app-connection/app-connection-maps.ts b/backend/src/services/app-connection/app-connection-maps.ts
index 3e8f006f66..b197ebc5b0 100644
--- a/backend/src/services/app-connection/app-connection-maps.ts
+++ b/backend/src/services/app-connection/app-connection-maps.ts
@@ -10,6 +10,7 @@ export const APP_CONNECTION_NAME_MAP: Record<AppConnection, string> = {
[AppConnection.AzureClientSecrets]: "Azure Client Secrets",
[AppConnection.AzureDevOps]: "Azure DevOps",
[AppConnection.AzureADCS]: "Azure ADCS",
+ [AppConnection.AzureDNS]: "Azure DNS",
[AppConnection.Databricks]: "Databricks",
[AppConnection.Humanitec]: "Humanitec",
[AppConnection.TerraformCloud]: "Terraform Cloud",
@@ -59,6 +60,7 @@ export const APP_CONNECTION_PLAN_MAP: Record<AppConnection, AppConnectionPlanTyp
[AppConnection.AzureClientSecrets]: AppConnectionPlanType.Regular,
[AppConnection.AzureDevOps]: AppConnectionPlanType.Regular,
[AppConnection.AzureADCS]: AppConnectionPlanType.Regular,
+ [AppConnection.AzureDNS]: AppConnectionPlanType.Regular,
[AppConnection.Databricks]: AppConnectionPlanType.Regular,
[AppConnection.Humanitec]: AppConnectionPlanType.Regular,
[AppConnection.TerraformCloud]: 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 99b0bef3ae..d170f2e3e5 100644
--- a/backend/src/services/app-connection/app-connection-service.ts
+++ b/backend/src/services/app-connection/app-connection-service.ts
@@ -62,6 +62,8 @@ import { ValidateAzureClientSecretsConnectionCredentialsSchema } from "./azure-c
import { azureClientSecretsConnectionService } from "./azure-client-secrets/azure-client-secrets-service";
import { ValidateAzureDevOpsConnectionCredentialsSchema } from "./azure-devops/azure-devops-schemas";
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 { ValidateAzureKeyVaultConnectionCredentialsSchema } from "./azure-key-vault";
import { ValidateBitbucketConnectionCredentialsSchema } from "./bitbucket";
import { bitbucketConnectionService } from "./bitbucket/bitbucket-connection-service";
@@ -174,6 +176,7 @@ const VALIDATE_APP_CONNECTION_CREDENTIALS_MAP: Record<AppConnection, TValidateAp
[AppConnection.GitLab]: ValidateGitLabConnectionCredentialsSchema,
[AppConnection.Cloudflare]: ValidateCloudflareConnectionCredentialsSchema,
[AppConnection.DNSMadeEasy]: ValidateDNSMadeEasyConnectionCredentialsSchema,
+ [AppConnection.AzureDNS]: ValidateAzureDnsConnectionCredentialsSchema,
[AppConnection.Zabbix]: ValidateZabbixConnectionCredentialsSchema,
[AppConnection.Railway]: ValidateRailwayConnectionCredentialsSchema,
[AppConnection.Bitbucket]: ValidateBitbucketConnectionCredentialsSchema,
@@ -894,6 +897,7 @@ export const appConnectionServiceFactory = ({
gitlab: gitlabConnectionService(connectAppConnectionById, appConnectionDAL, kmsService),
cloudflare: cloudflareConnectionService(connectAppConnectionById),
dnsMadeEasy: dnsMadeEasyConnectionService(connectAppConnectionById),
+ azureDns: azureDnsConnectionService(connectAppConnectionById),
zabbix: zabbixConnectionService(connectAppConnectionById),
railway: railwayConnectionService(connectAppConnectionById),
bitbucket: bitbucketConnectionService(connectAppConnectionById),
diff --git a/backend/src/services/app-connection/app-connection-types.ts b/backend/src/services/app-connection/app-connection-types.ts
index d40975d36b..156cee84d9 100644
--- a/backend/src/services/app-connection/app-connection-types.ts
+++ b/backend/src/services/app-connection/app-connection-types.ts
@@ -64,6 +64,12 @@ import {
TAzureDevOpsConnectionInput,
TValidateAzureDevOpsConnectionCredentialsSchema
} from "./azure-devops/azure-devops-types";
+import {
+ TAzureDnsConnection,
+ TAzureDnsConnectionConfig,
+ TAzureDnsConnectionInput,
+ TValidateAzureDnsConnectionCredentialsSchema
+} from "./azure-dns/azure-dns-connection-types";
import {
TAzureKeyVaultConnection,
TAzureKeyVaultConnectionConfig,
@@ -304,6 +310,7 @@ export type TAppConnection = { id: string } & (
| TCloudflareConnection
| TBitbucketConnection
| TDNSMadeEasyConnection
+ | TAzureDnsConnection
| TZabbixConnection
| TRailwayConnection
| TChecklyConnection
@@ -357,6 +364,7 @@ export type TAppConnectionInput = { id: string } & (
| TCloudflareConnectionInput
| TBitbucketConnectionInput
| TDNSMadeEasyConnectionInput
+ | TAzureDnsConnectionInput
| TZabbixConnectionInput
| TRailwayConnectionInput
| TChecklyConnectionInput
@@ -428,6 +436,7 @@ export type TAppConnectionConfig =
| TCloudflareConnectionConfig
| TBitbucketConnectionConfig
| TDNSMadeEasyConnectionConfig
+ | TAzureDnsConnectionConfig
| TZabbixConnectionConfig
| TRailwayConnectionConfig
| TChecklyConnectionConfig
@@ -476,6 +485,7 @@ export type TValidateAppConnectionCredentialsSchema =
| TValidateCloudflareConnectionCredentialsSchema
| TValidateBitbucketConnectionCredentialsSchema
| TValidateDNSMadeEasyConnectionCredentialsSchema
+ | TValidateAzureDnsConnectionCredentialsSchema
| TValidateZabbixConnectionCredentialsSchema
| TValidateRailwayConnectionCredentialsSchema
| TValidateChecklyConnectionCredentialsSchema
diff --git a/backend/src/services/app-connection/azure-dns/azure-dns-connection-enum.ts b/backend/src/services/app-connection/azure-dns/azure-dns-connection-enum.ts
new file mode 100644
index 0000000000..13528cf4a3
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/azure-dns-connection-enum.ts
@@ -0,0 +1,3 @@
+export enum AzureDnsConnectionMethod {
+ ClientSecret = "client-secret"
+}
diff --git a/backend/src/services/app-connection/azure-dns/azure-dns-connection-fns.ts b/backend/src/services/app-connection/azure-dns/azure-dns-connection-fns.ts
new file mode 100644
index 0000000000..70c374a5da
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/azure-dns-connection-fns.ts
@@ -0,0 +1,159 @@
+import { AxiosError } from "axios";
+
+import { request } from "@app/lib/config/request";
+import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { AppConnection } from "@app/services/app-connection/app-connection-enums";
+
+import { AzureDnsConnectionMethod } from "./azure-dns-connection-enum";
+import { TAzureDnsConnection, TAzureDnsConnectionConfig, TAzureDnsZone } from "./azure-dns-connection-types";
+
+interface AzureDnsZonesResponse {
+ value: Array<{
+ id: string;
+ name: string;
+ type: string;
+ properties?: {
+ nameServers?: string[];
+ };
+ }>;
+ nextLink?: string;
+}
+
+export const getAzureDnsAccessToken = async (
+ tenantId: string,
+ clientId: string,
+ clientSecret: string
+): Promise<string> => {
+ const tokenResponse = await request.post<{ access_token: string; expires_in: number }>(
+ `https://login.microsoftonline.com/${tenantId}/oauth2/v2.0/token`,
+ new URLSearchParams({
+ grant_type: "client_credentials",
+ client_id: clientId,
+ client_secret: clientSecret,
+ scope: "https://management.azure.com/.default"
+ }).toString(),
+ {
+ headers: {
+ "Content-Type": "application/x-www-form-urlencoded"
+ }
+ }
+ );
+
+ return tokenResponse.data.access_token;
+};
+
+export const getAzureDnsConnectionListItem = () => {
+ return {
+ name: "Azure DNS" as const,
+ app: AppConnection.AzureDNS as const,
+ methods: Object.values(AzureDnsConnectionMethod) as [AzureDnsConnectionMethod.ClientSecret]
+ };
+};
+
+export const listAzureDnsZones = async (appConnection: TAzureDnsConnection): Promise<TAzureDnsZone[]> => {
+ if (appConnection.method !== AzureDnsConnectionMethod.ClientSecret) {
+ throw new BadRequestError({ message: "Unsupported Azure DNS connection method" });
+ }
+
+ const {
+ credentials: { tenantId, clientId, clientSecret, subscriptionId }
+ } = appConnection;
+
+ try {
+ const accessToken = await getAzureDnsAccessToken(tenantId, clientId, clientSecret);
+
+ const allZones: TAzureDnsZone[] = [];
+ const baseUrl = `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.Network/dnszones?api-version=2018-05-01`;
+
+ const fetchZones = async (url: string): Promise<AzureDnsZonesResponse> => {
+ const resp = await request.get<AzureDnsZonesResponse>(url, {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ });
+ return resp.data;
+ };
+
+ let response = await fetchZones(baseUrl);
+
+ while (response) {
+ if (response.value) {
+ const zones = response.value.map((zone) => ({
+ id: zone.id,
+ name: zone.name
+ }));
+ allZones.push(...zones);
+ }
+
+ if (!response.nextLink) {
+ break;
+ }
+
+ // eslint-disable-next-line no-await-in-loop
+ response = await fetchZones(response.nextLink);
+ }
+
+ return allZones;
+ } catch (error: unknown) {
+ logger.error(error, "Error listing Azure DNS zones");
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to list Azure DNS zones: ${
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ error.response?.data?.error?.message || error.message || "Unknown error"
+ }`
+ });
+ }
+ throw new BadRequestError({
+ message: "Unable to list Azure DNS zones"
+ });
+ }
+};
+
+export const validateAzureDnsConnectionCredentials = async (config: TAzureDnsConnectionConfig) => {
+ if (config.method !== AzureDnsConnectionMethod.ClientSecret) {
+ throw new BadRequestError({ message: "Unsupported Azure DNS connection method" });
+ }
+
+ const { tenantId, clientId, clientSecret, subscriptionId } = config.credentials;
+
+ try {
+ const accessToken = await getAzureDnsAccessToken(tenantId, clientId, clientSecret);
+
+ const resp = await request.get(
+ `https://management.azure.com/subscriptions/${subscriptionId}/providers/Microsoft.Network/dnszones?api-version=2018-05-01`,
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+
+ if (resp.status !== 200) {
+ throw new BadRequestError({
+ message: "Unable to validate connection: Invalid credentials provided."
+ });
+ }
+ } catch (error: unknown) {
+ if (error instanceof AxiosError) {
+ throw new BadRequestError({
+ message: `Failed to validate credentials: ${
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ error.response?.data?.error?.message || error.message || "Unknown error"
+ }`
+ });
+ }
+ if (error instanceof BadRequestError) {
+ throw error;
+ }
+ logger.error(error, "Error validating Azure DNS connection credentials");
+ throw new BadRequestError({
+ message: "Unable to validate connection: verify credentials"
+ });
+ }
+
+ return config.credentials;
+};
diff --git a/backend/src/services/app-connection/azure-dns/azure-dns-connection-schema.ts b/backend/src/services/app-connection/azure-dns/azure-dns-connection-schema.ts
new file mode 100644
index 0000000000..bfaae26276
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/azure-dns-connection-schema.ts
@@ -0,0 +1,74 @@
+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 { AzureDnsConnectionMethod } from "./azure-dns-connection-enum";
+
+export const AzureDnsConnectionClientSecretCredentialsSchema = z.object({
+ tenantId: z.string().trim().min(1, "Tenant ID required").max(256, "Tenant ID cannot exceed 256 characters"),
+ clientId: z.string().trim().min(1, "Client ID required").max(256, "Client ID cannot exceed 256 characters"),
+ clientSecret: z
+ .string()
+ .trim()
+ .min(1, "Client secret required")
+ .max(256, "Client secret cannot exceed 256 characters"),
+ subscriptionId: z
+ .string()
+ .trim()
+ .min(1, "Subscription ID required")
+ .max(256, "Subscription ID cannot exceed 256 characters")
+});
+
+const BaseAzureDnsConnectionSchema = BaseAppConnectionSchema.extend({
+ app: z.literal(AppConnection.AzureDNS)
+});
+
+export const AzureDnsConnectionSchema = BaseAzureDnsConnectionSchema.extend({
+ method: z.literal(AzureDnsConnectionMethod.ClientSecret),
+ credentials: AzureDnsConnectionClientSecretCredentialsSchema
+});
+
+export const SanitizedAzureDnsConnectionSchema = z.discriminatedUnion("method", [
+ BaseAzureDnsConnectionSchema.extend({
+ method: z.literal(AzureDnsConnectionMethod.ClientSecret),
+ credentials: AzureDnsConnectionClientSecretCredentialsSchema.pick({ tenantId: true, subscriptionId: true })
+ }).describe(JSON.stringify({ title: `${APP_CONNECTION_NAME_MAP[AppConnection.AzureDNS]} (Client Secret)` }))
+]);
+
+export const ValidateAzureDnsConnectionCredentialsSchema = z.discriminatedUnion("method", [
+ z.object({
+ method: z
+ .literal(AzureDnsConnectionMethod.ClientSecret)
+ .describe(AppConnections.CREATE(AppConnection.AzureDNS).method),
+ credentials: AzureDnsConnectionClientSecretCredentialsSchema.describe(
+ AppConnections.CREATE(AppConnection.AzureDNS).credentials
+ )
+ })
+]);
+
+export const CreateAzureDnsConnectionSchema = ValidateAzureDnsConnectionCredentialsSchema.and(
+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureDNS)
+);
+
+export const UpdateAzureDnsConnectionSchema = z
+ .object({
+ credentials: AzureDnsConnectionClientSecretCredentialsSchema.optional().describe(
+ AppConnections.UPDATE(AppConnection.AzureDNS).credentials
+ )
+ })
+ .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.AzureDNS));
+
+export const AzureDnsConnectionListItemSchema = z
+ .object({
+ name: z.literal("Azure DNS"),
+ app: z.literal(AppConnection.AzureDNS),
+ methods: z.nativeEnum(AzureDnsConnectionMethod).array()
+ })
+ .describe(JSON.stringify({ title: APP_CONNECTION_NAME_MAP[AppConnection.AzureDNS] }));
diff --git a/backend/src/services/app-connection/azure-dns/azure-dns-connection-service.ts b/backend/src/services/app-connection/azure-dns/azure-dns-connection-service.ts
new file mode 100644
index 0000000000..13d7b25da0
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/azure-dns-connection-service.ts
@@ -0,0 +1,32 @@
+import { BadRequestError } from "@app/lib/errors";
+import { logger } from "@app/lib/logger";
+import { OrgServiceActor } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import { listAzureDnsZones } from "./azure-dns-connection-fns";
+import { TAzureDnsConnection } from "./azure-dns-connection-types";
+
+type TGetAppConnectionFunc = (
+ app: AppConnection,
+ connectionId: string,
+ actor: OrgServiceActor
+) => Promise<TAzureDnsConnection>;
+
+export const azureDnsConnectionService = (getAppConnection: TGetAppConnectionFunc) => {
+ const listZones = async (connectionId: string, actor: OrgServiceActor) => {
+ const appConnection = await getAppConnection(AppConnection.AzureDNS, connectionId, actor);
+ try {
+ const zones = await listAzureDnsZones(appConnection);
+ return zones;
+ } catch (error) {
+ logger.error(error, `Failed to list Azure DNS zones for Azure DNS connection [connectionId=${connectionId}]`);
+ throw new BadRequestError({
+ message: `Failed to list Azure DNS zones: ${error instanceof Error ? error.message : "Unknown error"}`
+ });
+ }
+ };
+
+ return {
+ listZones
+ };
+};
diff --git a/backend/src/services/app-connection/azure-dns/azure-dns-connection-types.ts b/backend/src/services/app-connection/azure-dns/azure-dns-connection-types.ts
new file mode 100644
index 0000000000..1c78482c65
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/azure-dns-connection-types.ts
@@ -0,0 +1,30 @@
+import z from "zod";
+
+import { DiscriminativePick } from "@app/lib/types";
+
+import { AppConnection } from "../app-connection-enums";
+import {
+ AzureDnsConnectionSchema,
+ CreateAzureDnsConnectionSchema,
+ ValidateAzureDnsConnectionCredentialsSchema
+} from "./azure-dns-connection-schema";
+
+export type TAzureDnsConnection = z.infer<typeof AzureDnsConnectionSchema>;
+
+export type TAzureDnsConnectionInput = z.infer<typeof CreateAzureDnsConnectionSchema> & {
+ app: AppConnection.AzureDNS;
+};
+
+export type TValidateAzureDnsConnectionCredentialsSchema = typeof ValidateAzureDnsConnectionCredentialsSchema;
+
+export type TAzureDnsConnectionConfig = DiscriminativePick<
+ TAzureDnsConnectionInput,
+ "method" | "app" | "credentials"
+> & {
+ orgId: string;
+};
+
+export type TAzureDnsZone = {
+ id: string;
+ name: string;
+};
diff --git a/backend/src/services/app-connection/azure-dns/index.ts b/backend/src/services/app-connection/azure-dns/index.ts
new file mode 100644
index 0000000000..93dfcd8269
--- /dev/null
+++ b/backend/src/services/app-connection/azure-dns/index.ts
@@ -0,0 +1,5 @@
+export * from "./azure-dns-connection-enum";
+export * from "./azure-dns-connection-fns";
+export * from "./azure-dns-connection-schema";
+export * from "./azure-dns-connection-service";
+export * from "./azure-dns-connection-types";
diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts
index 09431f4f84..7c1fcedd29 100644
--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts
+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-enums.ts
@@ -1,5 +1,6 @@
export enum AcmeDnsProvider {
Route53 = "route53",
Cloudflare = "cloudflare",
- DNSMadeEasy = "dns-made-easy"
+ DNSMadeEasy = "dns-made-easy",
+ AzureDNS = "azure-dns"
}
diff --git a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
index 9616b30903..0ad97bea9d 100644
--- a/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
+++ b/backend/src/services/certificate-authority/acme/acme-certificate-authority-fns.ts
@@ -15,6 +15,7 @@ import { AppConnection } from "@app/services/app-connection/app-connection-enums
import { decryptAppConnection } from "@app/services/app-connection/app-connection-fns";
import { TAppConnectionServiceFactory } from "@app/services/app-connection/app-connection-service";
import { TAwsConnection } from "@app/services/app-connection/aws/aws-connection-types";
+import { TAzureDnsConnection } from "@app/services/app-connection/azure-dns/azure-dns-connection-types";
import { TCloudflareConnection } from "@app/services/app-connection/cloudflare/cloudflare-connection-types";
import { TDNSMadeEasyConnection } from "@app/services/app-connection/dns-made-easy/dns-made-easy-connection-types";
import { TCertificateBodyDALFactory } from "@app/services/certificate/certificate-body-dal";
@@ -46,6 +47,7 @@ import {
TCreateAcmeCertificateAuthorityDTO,
TUpdateAcmeCertificateAuthorityDTO
} from "./acme-certificate-authority-types";
+import { azureDnsDeleteTxtRecord, azureDnsInsertTxtRecord } from "./dns-providers/azure-dns";
import { cloudflareDeleteTxtRecord, cloudflareInsertTxtRecord } from "./dns-providers/cloudflare";
import { dnsMadeEasyDeleteTxtRecord, dnsMadeEasyInsertTxtRecord } from "./dns-providers/dns-made-easy";
import { route53DeleteTxtRecord, route53InsertTxtRecord } from "./dns-providers/route54";
@@ -365,6 +367,15 @@ export const orderCertificate = async (
);
break;
}
+ case AcmeDnsProvider.AzureDNS: {
+ await azureDnsInsertTxtRecord(
+ connection as TAzureDnsConnection,
+ acmeCa.configuration.dnsProviderConfig.hostedZoneId,
+ recordName,
+ recordValue
+ );
+ break;
+ }
default: {
throw new Error(`Unsupported DNS provider: ${acmeCa.configuration.dnsProviderConfig.provider as string}`);
}
@@ -405,6 +416,15 @@ export const orderCertificate = async (
);
break;
}
+ case AcmeDnsProvider.AzureDNS: {
+ await azureDnsDeleteTxtRecord(
+ connection as TAzureDnsConnection,
+ acmeCa.configuration.dnsProviderConfig.hostedZoneId,
+ recordName,
+ recordValue
+ );
+ break;
+ }
default: {
throw new Error(`Unsupported DNS provider: ${acmeCa.configuration.dnsProviderConfig.provider as string}`);
}
@@ -560,6 +580,12 @@ export const AcmeCertificateAuthorityFns = ({
});
}
+ if (dnsProviderConfig.provider === AcmeDnsProvider.AzureDNS && appConnection.app !== AppConnection.AzureDNS) {
+ throw new BadRequestError({
+ message: `App connection with ID '${dnsAppConnectionId}' is not an Azure DNS connection`
+ });
+ }
+
// validates permission to connect
await appConnectionService.validateAppConnectionUsageById(
appConnection.app as AppConnection,
@@ -662,6 +688,12 @@ export const AcmeCertificateAuthorityFns = ({
});
}
+ if (dnsProviderConfig.provider === AcmeDnsProvider.AzureDNS && appConnection.app !== AppConnection.AzureDNS) {
+ throw new BadRequestError({
+ message: `App connection with ID '${dnsAppConnectionId}' is not an Azure DNS connection`
+ });
+ }
+
const ca = await certificateAuthorityDAL.findById(id);
if (!ca) {
diff --git a/backend/src/services/certificate-authority/acme/dns-providers/azure-dns.ts b/backend/src/services/certificate-authority/acme/dns-providers/azure-dns.ts
new file mode 100644
index 0000000000..cf91199190
--- /dev/null
+++ b/backend/src/services/certificate-authority/acme/dns-providers/azure-dns.ts
@@ -0,0 +1,86 @@
+import axios from "axios";
+
+import { request } from "@app/lib/config/request";
+import { logger } from "@app/lib/logger";
+import { getAzureDnsAccessToken } from "@app/services/app-connection/azure-dns/azure-dns-connection-fns";
+import { TAzureDnsConnection } from "@app/services/app-connection/azure-dns/azure-dns-connection-types";
+
+export const azureDnsInsertTxtRecord = async (
+ connection: TAzureDnsConnection,
+ hostedZoneId: string,
+ recordName: string,
+ value: string
+) => {
+ const {
+ credentials: { tenantId, clientId, clientSecret }
+ } = connection;
+
+ logger.info({ hostedZoneId, recordName, value }, "Inserting TXT record for Azure DNS");
+
+ try {
+ const accessToken = await getAzureDnsAccessToken(tenantId, clientId, clientSecret);
+
+ // e.g., /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.Network/dnsZones/{zoneName}
+ await request.put(
+ `https://management.azure.com${hostedZoneId}/TXT/${encodeURIComponent(recordName)}?api-version=2018-05-01`,
+ {
+ properties: {
+ TTL: 60,
+ TXTRecords: [{ value: [value.replace(/"/g, "")] }]
+ }
+ },
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ "Content-Type": "application/json",
+ Accept: "application/json"
+ }
+ }
+ );
+ } catch (error) {
+ if (axios.isAxiosError(error)) {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const errorMessage = (error.response?.data?.error?.message || error.message || "Unknown error") as string;
+ throw new Error(typeof errorMessage === "string" ? errorMessage : String(errorMessage));
+ }
+ throw error;
+ }
+};
+
+export const azureDnsDeleteTxtRecord = async (
+ connection: TAzureDnsConnection,
+ hostedZoneId: string,
+ recordName: string,
+ value: string
+) => {
+ const {
+ credentials: { tenantId, clientId, clientSecret }
+ } = connection;
+
+ logger.info({ hostedZoneId, recordName, value }, "Deleting TXT record for Azure DNS");
+
+ try {
+ const accessToken = await getAzureDnsAccessToken(tenantId, clientId, clientSecret);
+
+ await request.delete(
+ `https://management.azure.com${hostedZoneId}/TXT/${encodeURIComponent(recordName)}?api-version=2018-05-01`,
+ {
+ headers: {
+ Authorization: `Bearer ${accessToken}`,
+ Accept: "application/json"
+ }
+ }
+ );
+ } catch (error) {
+ if (axios.isAxiosError(error)) {
+ if (error.response?.status === 404) {
+ logger.warn({ hostedZoneId, recordName, value }, "TXT record not found for deletion");
+ return;
+ }
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ const errorMessage = (error.response?.data?.error?.message || error.message || "Unknown error") as string;
+ throw new Error(typeof errorMessage === "string" ? errorMessage : String(errorMessage));
+ }
+ throw error;
+ }
+};
diff --git a/docs/docs.json b/docs/docs.json
index 7ecbbd0568..85bccffaca 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -113,6 +113,7 @@
"integrations/app-connections/azure-adcs",
"integrations/app-connections/azure-client-secrets",
"integrations/app-connections/azure-devops",
+ "integrations/app-connections/azure-dns",
"integrations/app-connections/azure-key-vault",
"integrations/app-connections/bitbucket",
"integrations/app-connections/camunda",
diff --git a/docs/documentation/platform/pki/ca/acme-ca.mdx b/docs/documentation/platform/pki/ca/acme-ca.mdx
index 7f2290ff63..78467d18a4 100644
--- a/docs/documentation/platform/pki/ca/acme-ca.mdx
+++ b/docs/documentation/platform/pki/ca/acme-ca.mdx
@@ -17,7 +17,7 @@ their **ACME Directory URL** such as:
- ZeroSSL: `https://acme.zerossl.com/v2/DV90`.
- SSL.com: `https://acme.ssl.com/sslcom-dv-rsa`.
-When Infisical requests a certificate from an ACME-compatible CA, it creates a TXT record at `_acme-challenge.{your-domain}` in your configured DNS provider (e.g. Route53, Cloudflare, DNS Made Easy, etc.); this TXT record contains the challenge token issued by the ACME-compatible CA to validate domain control for the requested certificate.
+When Infisical requests a certificate from an ACME-compatible CA, it creates a TXT record at `_acme-challenge.{your-domain}` in your configured DNS provider (e.g. Route53, Cloudflare, Azure DNS, DNS Made Easy, etc.); this TXT record contains the challenge token issued by the ACME-compatible CA to validate domain control for the requested certificate.
The ACME provider checks for the existence of this TXT record to verify domain control before issuing the certificate back to Infisical.
After validation completes successfully, Infisical automatically removes the TXT record from your DNS provider.
@@ -120,6 +120,13 @@ In the following steps, we explore how to connect Infisical to an ACME-compatibl
For detailed instructions on setting up a Cloudflare connection, see the [Cloudflare Connection](/integrations/app-connections/cloudflare) documentation.
</Tab>
+ <Tab title="Azure DNS">
+ 1. Navigate to your Certificate Management Project > App Connections and create a new Azure DNS connection.
+
+ 2. Ensure your Azure Service Principal has the **DNS Zone Contributor** role assigned on the DNS Zone you want to use for validation.
+
+ For detailed instructions on setting up an Azure DNS connection, see the [Azure DNS Connection](/integrations/app-connections/azure-dns) documentation.
+ </Tab>
<Tab title="DNS Made Easy">
Navigate to your Certificate Management Project > App Connections and create a new DNS Made Easy connection.
@@ -218,14 +225,12 @@ In the following steps, we explore how to connect Infisical to an ACME-compatibl
<AccordionGroup>
<Accordion title="What DNS validation methods are supported?">
- Currently, Infisical supports DNS-01 validation through AWS Route53 or Cloudflare. The DNS-01 challenge method is preferred for ACME integrations because it:
+ Currently, Infisical supports DNS-01 validation through AWS Route53, Cloudflare, Azure DNS, and DNS Made Easy. The DNS-01 challenge method is preferred for ACME integrations because it:
- Works with wildcard certificates
- Doesn't require your servers to be publicly accessible
- Can be fully automated without manual intervention
- Support for additional DNS providers is planned for future releases.
-
</Accordion>
<Accordion title="Can I use wildcard certificates with ACME CAs?">
Yes! ACME CAs like Let's Encrypt support wildcard certificates (e.g., `*.example.com`) when using DNS-01 validation. Simply specify the wildcard domain in your subscriber configuration.
diff --git a/docs/images/app-connections/azure-dns/azure-dns-app-connection-created.png b/docs/images/app-connections/azure-dns/azure-dns-app-connection-created.png
new file mode 100644
index 0000000000..413481d277
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-app-connection-created.png differ
diff --git a/docs/images/app-connections/azure-dns/azure-dns-app-connection-form.png b/docs/images/app-connections/azure-dns/azure-dns-app-connection-form.png
new file mode 100644
index 0000000000..86a7ade62a
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-app-connection-form.png differ
diff --git a/docs/images/app-connections/azure-dns/azure-dns-app-connection-select.png b/docs/images/app-connections/azure-dns/azure-dns-app-connection-select.png
new file mode 100644
index 0000000000..4561d926cb
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-app-connection-select.png differ
diff --git a/docs/images/app-connections/azure-dns/azure-dns-role.png b/docs/images/app-connections/azure-dns/azure-dns-role.png
new file mode 100644
index 0000000000..ba236e711f
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-role.png differ
diff --git a/docs/images/app-connections/azure-dns/azure-dns-select-sp.png b/docs/images/app-connections/azure-dns/azure-dns-select-sp.png
new file mode 100644
index 0000000000..10c1854a3c
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-select-sp.png differ
diff --git a/docs/images/app-connections/azure-dns/azure-dns-zone.png b/docs/images/app-connections/azure-dns/azure-dns-zone.png
new file mode 100644
index 0000000000..29208b3b44
Binary files /dev/null and b/docs/images/app-connections/azure-dns/azure-dns-zone.png differ
diff --git a/docs/integrations/app-connections/azure-dns.mdx b/docs/integrations/app-connections/azure-dns.mdx
new file mode 100644
index 0000000000..8ea6821e21
--- /dev/null
+++ b/docs/integrations/app-connections/azure-dns.mdx
@@ -0,0 +1,60 @@
+---
+title: "Azure DNS Connection"
+description: "Learn how to configure an Azure DNS Connection for Infisical."
+---
+
+Infisical supports connecting to Azure DNS using a Service Principal with Client Secrets for secure access to manage DNS records in your Azure DNS zones.
+
+<Accordion title="Client Secret Authentication">
+ To use client secret authentication, ensure your Azure Service Principal has the required permissions to manage DNS records in your Azure DNS Zone.
+
+ **Prerequisites:**
+ - Set up Azure and have an existing DNS Zone.
+ - An Azure Service Principal (App Registration) with a Client Secret.
+
+ <Steps>
+ <Step title="Navigate to your DNS Zone">
+ In the Azure Portal, navigate to your DNS Zone that you want to use for ACME DNS validation. Click on **Access control (IAM)** in the left sidebar, then click **Add** > **Add role assignment**.
+
+ ![Navigate to DNS Zone](/images/app-connections/azure-dns/azure-dns-zone.png)
+ </Step>
+ <Step title="Assign DNS Zone Contributor Role">
+ Search for and select the **DNS Zone Contributor** role, then click **Next**.
+
+ ![Select DNS Zone Contributor Role](/images/app-connections/azure-dns/azure-dns-role.png)
+ </Step>
+ <Step title="Select your Service Principal">
+ Click **Select members**, search for your App Registration (Service Principal), select it, and click **Select**.
+
+ ![Select Service Principal](/images/app-connections/azure-dns/azure-dns-select-sp.png)
+
+ Click **Review + assign** to complete the role assignment.
+ </Step>
+ </Steps>
+</Accordion>
+
+## Setup Azure DNS Connection in Infisical
+
+<Steps>
+ <Step title="Navigate to App Connections">
+ Navigate to the **App Connections** page in the desired project.
+ ![App Connections Tab](/images/app-connections/general/add-connection.png)
+ </Step>
+ <Step title="Add Connection">
+ Select the **Azure DNS Connection** option from the connection options modal.
+ ![Select Azure DNS Connection](/images/app-connections/azure-dns/azure-dns-app-connection-select.png)
+ </Step>
+ <Step title="Create Connection">
+ Fill in the **Tenant ID**, **Client ID**, **Client Secret**, and **Subscription ID** fields with the credentials from your Azure Service Principal.
+
+ ![Connect to Azure DNS](/images/app-connections/azure-dns/azure-dns-app-connection-form.png)
+
+ <Tip>
+ You can find your **Subscription ID** in the Azure Portal under **Subscriptions**. The **Tenant ID** and **Client ID** can be found in your App Registration's **Overview** page.
+ </Tip>
+ </Step>
+ <Step title="Connection Created">
+ Your **Azure DNS Connection** is now available for use in your Infisical projects.
+ ![Azure DNS Connection Created](/images/app-connections/azure-dns/azure-dns-app-connection-created.png)
+ </Step>
+</Steps>
diff --git a/docs/snippets/AppConnectionsBrowser.jsx b/docs/snippets/AppConnectionsBrowser.jsx
index 0314b5ebfd..96f1cebbcf 100644
--- a/docs/snippets/AppConnectionsBrowser.jsx
+++ b/docs/snippets/AppConnectionsBrowser.jsx
@@ -242,6 +242,13 @@ export const AppConnectionsBrowser = () => {
description: "Learn how to connect Infisical to DNS Made Easy.",
category: "Networking & DNS",
},
+ {
+ name: "Azure DNS",
+ slug: "azure-dns",
+ path: "/integrations/app-connections/azure-dns",
+ description: "Learn how to connect Infisical to Azure DNS for ACME DNS validation.",
+ category: "Networking & DNS",
+ },
{
name: "Windmill",
slug: "windmill",
diff --git a/frontend/src/helpers/appConnections.ts b/frontend/src/helpers/appConnections.ts
index f2bac4054d..c814d56179 100644
--- a/frontend/src/helpers/appConnections.ts
+++ b/frontend/src/helpers/appConnections.ts
@@ -47,6 +47,7 @@ import {
WindmillConnectionMethod,
ZabbixConnectionMethod
} from "@app/hooks/api/appConnections/types";
+import { AzureDNSConnectionMethod } from "@app/hooks/api/appConnections/types/azure-dns-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";
@@ -94,6 +95,7 @@ export const APP_CONNECTION_MAP: Record<
},
[AppConnection.AzureDevOps]: { name: "Azure DevOps", image: "Microsoft Azure.png" },
[AppConnection.AzureADCS]: { name: "Azure ADCS", image: "Microsoft Azure.png" },
+ [AppConnection.AzureDNS]: { name: "Azure DNS", image: "Microsoft Azure.png" },
[AppConnection.Databricks]: { name: "Databricks", image: "Databricks.png" },
[AppConnection.Humanitec]: { name: "Humanitec", image: "Humanitec.png" },
[AppConnection.TerraformCloud]: { name: "Terraform Cloud", image: "Terraform Cloud.png" },
@@ -225,6 +227,8 @@ export const getAppConnectionMethodDetails = (method: TAppConnection["method"])
return { name: "Certificate", icon: faCertificate };
case DNSMadeEasyConnectionMethod.APIKeySecret:
return { name: "API Key & Secret", icon: faKey };
+ case AzureDNSConnectionMethod.ClientSecret:
+ return { name: "Client Secret", icon: faKey };
case OctopusDeployConnectionMethod.ApiKey:
return { name: "API Key", icon: faKey };
case SshConnectionMethod.Password:
diff --git a/frontend/src/hooks/api/appConnections/azure-dns/index.ts b/frontend/src/hooks/api/appConnections/azure-dns/index.ts
new file mode 100644
index 0000000000..2c1906d369
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/azure-dns/index.ts
@@ -0,0 +1,2 @@
+export * from "./queries";
+export * from "./types";
diff --git a/frontend/src/hooks/api/appConnections/azure-dns/queries.tsx b/frontend/src/hooks/api/appConnections/azure-dns/queries.tsx
new file mode 100644
index 0000000000..b694b63c3e
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/azure-dns/queries.tsx
@@ -0,0 +1,37 @@
+import { useQuery, UseQueryOptions } from "@tanstack/react-query";
+
+import { apiRequest } from "@app/config/request";
+
+import { appConnectionKeys } from "../queries";
+import { TAzureDNSZone } from "./types";
+
+const azureDnsConnectionKeys = {
+ all: [...appConnectionKeys.all, "azure-dns"] as const,
+ listZones: (connectionId: string) =>
+ [...azureDnsConnectionKeys.all, "zones", connectionId] as const
+};
+
+export const useAzureDNSConnectionListZones = (
+ connectionId: string,
+ options?: Omit<
+ UseQueryOptions<
+ TAzureDNSZone[],
+ unknown,
+ TAzureDNSZone[],
+ ReturnType<typeof azureDnsConnectionKeys.listZones>
+ >,
+ "queryKey" | "queryFn"
+ >
+) => {
+ return useQuery({
+ queryKey: azureDnsConnectionKeys.listZones(connectionId),
+ queryFn: async () => {
+ const { data } = await apiRequest.get<TAzureDNSZone[]>(
+ `/api/v1/app-connections/azure-dns/${connectionId}/azure-dns-zones`
+ );
+
+ return data;
+ },
+ ...options
+ });
+};
diff --git a/frontend/src/hooks/api/appConnections/azure-dns/types.ts b/frontend/src/hooks/api/appConnections/azure-dns/types.ts
new file mode 100644
index 0000000000..0837f326a4
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/azure-dns/types.ts
@@ -0,0 +1,4 @@
+export type TAzureDNSZone = {
+ id: string;
+ name: string;
+};
diff --git a/frontend/src/hooks/api/appConnections/enums.ts b/frontend/src/hooks/api/appConnections/enums.ts
index 634f8ba208..9d03da5412 100644
--- a/frontend/src/hooks/api/appConnections/enums.ts
+++ b/frontend/src/hooks/api/appConnections/enums.ts
@@ -8,6 +8,7 @@ export enum AppConnection {
AzureClientSecrets = "azure-client-secrets",
AzureDevOps = "azure-devops",
AzureADCS = "azure-adcs",
+ AzureDNS = "azure-dns",
Databricks = "databricks",
Humanitec = "humanitec",
TerraformCloud = "terraform-cloud",
diff --git a/frontend/src/hooks/api/appConnections/types/app-options.ts b/frontend/src/hooks/api/appConnections/types/app-options.ts
index bb26e0d59d..d8a595b7b4 100644
--- a/frontend/src/hooks/api/appConnections/types/app-options.ts
+++ b/frontend/src/hooks/api/appConnections/types/app-options.ts
@@ -196,6 +196,10 @@ export type TDNSMadeEasyConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.DNSMadeEasy;
};
+export type TAzureDNSConnectionOption = TAppConnectionOptionBase & {
+ app: AppConnection.AzureDNS;
+};
+
export type TSshConnectionOption = TAppConnectionOptionBase & {
app: AppConnection.SSH;
};
@@ -245,6 +249,7 @@ export type TAppConnectionOption =
| TMongoDBConnectionOption
| TChefConnectionOption
| TDNSMadeEasyConnectionOption
+ | TAzureDNSConnectionOption
| TOctopusDeployConnectionOption
| TSshConnectionOption;
@@ -293,6 +298,7 @@ export type TAppConnectionOptionMap = {
[AppConnection.MongoDB]: TMongoDBConnectionOption;
[AppConnection.LaravelForge]: TLaravelForgeConnectionOption;
[AppConnection.Chef]: TChefConnectionOption;
+ [AppConnection.AzureDNS]: TAzureDNSConnectionOption;
[AppConnection.OctopusDeploy]: TOctopusDeployConnectionOption;
[AppConnection.SSH]: TSshConnectionOption;
};
diff --git a/frontend/src/hooks/api/appConnections/types/azure-dns-connection.ts b/frontend/src/hooks/api/appConnections/types/azure-dns-connection.ts
new file mode 100644
index 0000000000..712d2fc337
--- /dev/null
+++ b/frontend/src/hooks/api/appConnections/types/azure-dns-connection.ts
@@ -0,0 +1,15 @@
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { TRootAppConnection } from "@app/hooks/api/appConnections/types/root-connection";
+
+export enum AzureDNSConnectionMethod {
+ ClientSecret = "client-secret"
+}
+
+export type TAzureDNSConnection = TRootAppConnection & { app: AppConnection.AzureDNS } & {
+ method: AzureDNSConnectionMethod.ClientSecret;
+ credentials: {
+ tenantId: string;
+ clientId: string;
+ subscriptionId: string;
+ };
+};
diff --git a/frontend/src/hooks/api/appConnections/types/index.ts b/frontend/src/hooks/api/appConnections/types/index.ts
index 4cf63d2182..8d6274ddcd 100644
--- a/frontend/src/hooks/api/appConnections/types/index.ts
+++ b/frontend/src/hooks/api/appConnections/types/index.ts
@@ -7,6 +7,7 @@ import { TAzureADCSConnection } from "./azure-adcs-connection";
import { TAzureAppConfigurationConnection } from "./azure-app-configuration-connection";
import { TAzureClientSecretsConnection } from "./azure-client-secrets-connection";
import { TAzureDevOpsConnection } from "./azure-devops-connection";
+import { TAzureDNSConnection } from "./azure-dns-connection";
import { TAzureKeyVaultConnection } from "./azure-key-vault-connection";
import { TBitbucketConnection } from "./bitbucket-connection";
import { TCamundaConnection } from "./camunda-connection";
@@ -54,6 +55,7 @@ export * from "./azure-adcs-connection";
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-key-vault-connection";
export * from "./bitbucket-connection";
export * from "./camunda-connection";
@@ -139,6 +141,7 @@ export type TAppConnection =
| TMongoDBConnection
| TChefConnection
| TDNSMadeEasyConnection
+ | TAzureDNSConnection
| TSshConnection;
export type TAvailableAppConnection = Pick<TAppConnection, "name" | "id" | "projectId">;
diff --git a/frontend/src/hooks/api/ca/constants.tsx b/frontend/src/hooks/api/ca/constants.tsx
index 740d52994f..3c2e951beb 100644
--- a/frontend/src/hooks/api/ca/constants.tsx
+++ b/frontend/src/hooks/api/ca/constants.tsx
@@ -17,13 +17,15 @@ export const caStatusToNameMap: { [K in CaStatus]: string } = {
export const ACME_DNS_PROVIDER_NAME_MAP: Record<AcmeDnsProvider, string> = {
[AcmeDnsProvider.ROUTE53]: "Route53",
[AcmeDnsProvider.Cloudflare]: "Cloudflare",
- [AcmeDnsProvider.DNSMadeEasy]: "DNS Made Easy"
+ [AcmeDnsProvider.DNSMadeEasy]: "DNS Made Easy",
+ [AcmeDnsProvider.AzureDNS]: "Azure DNS"
};
export const ACME_DNS_PROVIDER_APP_CONNECTION_MAP: Record<AcmeDnsProvider, AppConnection> = {
[AcmeDnsProvider.ROUTE53]: AppConnection.AWS,
[AcmeDnsProvider.Cloudflare]: AppConnection.Cloudflare,
- [AcmeDnsProvider.DNSMadeEasy]: AppConnection.DNSMadeEasy
+ [AcmeDnsProvider.DNSMadeEasy]: AppConnection.DNSMadeEasy,
+ [AcmeDnsProvider.AzureDNS]: AppConnection.AzureDNS
};
export const CA_TYPE_CAPABILITIES_MAP: Record<CaType, CaCapability[]> = {
diff --git a/frontend/src/hooks/api/ca/enums.tsx b/frontend/src/hooks/api/ca/enums.tsx
index acd8ce069b..626fdcf7ae 100644
--- a/frontend/src/hooks/api/ca/enums.tsx
+++ b/frontend/src/hooks/api/ca/enums.tsx
@@ -22,7 +22,8 @@ export enum CaRenewalType {
export enum AcmeDnsProvider {
ROUTE53 = "route53",
Cloudflare = "cloudflare",
- DNSMadeEasy = "dns-made-easy"
+ DNSMadeEasy = "dns-made-easy",
+ AzureDNS = "azure-dns"
}
export enum CaCapability {
diff --git a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
index 9d7fd6781b..413d6d9bde 100644
--- a/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
+++ b/frontend/src/pages/cert-manager/CertificateAuthoritiesPage/components/ExternalCaModal.tsx
@@ -22,6 +22,10 @@ import {
TAvailableAppConnection,
useListAvailableAppConnections
} from "@app/hooks/api/appConnections";
+import {
+ TAzureDNSZone,
+ useAzureDNSConnectionListZones
+} from "@app/hooks/api/appConnections/azure-dns";
import {
TCloudflareZone,
useCloudflareConnectionListZones
@@ -215,6 +219,11 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
enabled: caType === CaType.ACME
});
+ const { data: availableAzureDNSConnections, isPending: isAzureDNSPending } =
+ useListAvailableAppConnections(AppConnection.AzureDNS, currentProject.id, {
+ enabled: caType === CaType.ACME
+ });
+
const { data: availableAzureConnections, isPending: isAzurePending } =
useListAvailableAppConnections(AppConnection.AzureADCS, currentProject.id, {
enabled: caType === CaType.AZURE_AD_CS
@@ -227,13 +236,15 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
return [
...(availableRoute53Connections || []),
...(availableCloudflareConnections || []),
- ...(availableDNSMadeEasyConnections || [])
+ ...(availableDNSMadeEasyConnections || []),
+ ...(availableAzureDNSConnections || [])
];
}, [
caType,
availableRoute53Connections,
availableCloudflareConnections,
availableDNSMadeEasyConnections,
+ availableAzureDNSConnections,
availableAzureConnections
]);
@@ -241,6 +252,7 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
isRoute53Pending ||
isCloudflarePending ||
isDNSMadeEasyPending ||
+ isAzureDNSPending ||
(isAzurePending && caType === CaType.AZURE_AD_CS);
const dnsAppConnection =
@@ -258,6 +270,11 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
enabled: dnsProvider === AcmeDnsProvider.DNSMadeEasy && !!dnsAppConnection.id
});
+ const { data: azureDnsZones = [], isPending: isAzureDNSZonesPending } =
+ useAzureDNSConnectionListZones(dnsAppConnection.id, {
+ enabled: dnsProvider === AcmeDnsProvider.AzureDNS && !!dnsAppConnection.id
+ });
+
// Populate form with CA data when editing
useEffect(() => {
if (ca && !isCaLoading) {
@@ -538,6 +555,32 @@ export const ExternalCaModal = ({ popUp, handlePopUpToggle }: Props) => {
)}
/>
)}
+ {dnsProvider === AcmeDnsProvider.AzureDNS && (
+ <Controller
+ name="configuration.dnsProviderConfig.hostedZoneId"
+ control={control}
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Zone"
+ >
+ <FilterableSelect
+ isLoading={isAzureDNSZonesPending && !!dnsAppConnection.id}
+ isDisabled={!dnsAppConnection.id}
+ value={azureDnsZones.find((zone) => zone.id === value)}
+ onChange={(option) => {
+ onChange((option as SingleValue<TAzureDNSZone>)?.id ?? null);
+ }}
+ options={azureDnsZones}
+ placeholder="Select a zone..."
+ getOptionLabel={(option) => option.name}
+ getOptionValue={(option) => option.id}
+ />
+ </FormControl>
+ )}
+ />
+ )}
<Controller
control={control}
defaultValue=""
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 199858f47b..8d8a782a61 100644
--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AppConnectionForm.tsx
@@ -16,6 +16,7 @@ import { AzureADCSConnectionForm } from "./AzureADCSConnectionForm";
import { AzureAppConfigurationConnectionForm } from "./AzureAppConfigurationConnectionForm";
import { AzureClientSecretsConnectionForm } from "./AzureClientSecretsConnectionForm";
import { AzureDevOpsConnectionForm } from "./AzureDevOpsConnectionForm";
+import { AzureDNSConnectionForm } from "./AzureDNSConnectionForm";
import { AzureKeyVaultConnectionForm } from "./AzureKeyVaultConnectionForm";
import { BitbucketConnectionForm } from "./BitbucketConnectionForm";
import { CamundaConnectionForm } from "./CamundaConnectionForm";
@@ -154,6 +155,8 @@ const CreateForm = ({ app, onComplete, projectId }: CreateFormProps) => {
return <CloudflareConnectionForm onSubmit={onSubmit} />;
case AppConnection.DNSMadeEasy:
return <DNSMadeEasyConnectionForm onSubmit={onSubmit} />;
+ case AppConnection.AzureDNS:
+ return <AzureDNSConnectionForm onSubmit={onSubmit} />;
case AppConnection.Bitbucket:
return <BitbucketConnectionForm onSubmit={onSubmit} />;
case AppConnection.Zabbix:
@@ -320,6 +323,8 @@ const UpdateForm = ({ appConnection, onComplete }: UpdateFormProps) => {
return <CloudflareConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.DNSMadeEasy:
return <DNSMadeEasyConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
+ case AppConnection.AzureDNS:
+ return <AzureDNSConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Bitbucket:
return <BitbucketConnectionForm onSubmit={onSubmit} appConnection={appConnection} />;
case AppConnection.Zabbix:
diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDNSConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDNSConnectionForm.tsx
new file mode 100644
index 0000000000..ec627bd04f
--- /dev/null
+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureDNSConnectionForm.tsx
@@ -0,0 +1,198 @@
+import { Controller, FormProvider, useForm } from "react-hook-form";
+import { zodResolver } from "@hookform/resolvers/zod";
+import { z } from "zod";
+
+import {
+ Button,
+ FormControl,
+ Input,
+ ModalClose,
+ SecretInput,
+ Select,
+ SelectItem
+} from "@app/components/v2";
+import { APP_CONNECTION_MAP, getAppConnectionMethodDetails } from "@app/helpers/appConnections";
+import { TAzureDNSConnection } from "@app/hooks/api/appConnections";
+import { AppConnection } from "@app/hooks/api/appConnections/enums";
+import { AzureDNSConnectionMethod } from "@app/hooks/api/appConnections/types/azure-dns-connection";
+
+import {
+ genericAppConnectionFieldsSchema,
+ GenericAppConnectionsFields
+} from "./GenericAppConnectionFields";
+
+type Props = {
+ appConnection?: TAzureDNSConnection;
+ onSubmit: (formData: FormData) => Promise<void>;
+};
+
+const rootSchema = genericAppConnectionFieldsSchema.extend({
+ app: z.literal(AppConnection.AzureDNS)
+});
+
+const formSchema = z.discriminatedUnion("method", [
+ rootSchema.extend({
+ method: z.literal(AzureDNSConnectionMethod.ClientSecret),
+ credentials: z.object({
+ tenantId: z.string().trim().min(1, "Tenant ID required"),
+ clientId: z.string().trim().min(1, "Client ID required"),
+ clientSecret: z.string().trim().min(1, "Client Secret required"),
+ subscriptionId: z.string().trim().min(1, "Subscription ID required")
+ })
+ })
+]);
+
+type FormData = z.infer<typeof formSchema>;
+
+export const AzureDNSConnectionForm = ({ appConnection, onSubmit }: Props) => {
+ const isUpdate = Boolean(appConnection);
+
+ const form = useForm<FormData>({
+ resolver: zodResolver(formSchema),
+ defaultValues: appConnection ?? {
+ app: AppConnection.AzureDNS,
+ method: AzureDNSConnectionMethod.ClientSecret,
+ credentials: {
+ tenantId: "",
+ clientId: "",
+ clientSecret: "",
+ subscriptionId: ""
+ }
+ }
+ });
+
+ 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.AzureDNS].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(AzureDNSConnectionMethod).map((method) => {
+ return (
+ <SelectItem value={method} key={method}>
+ {getAppConnectionMethodDetails(method).name}{" "}
+ </SelectItem>
+ );
+ })}
+ </Select>
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.tenantId"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Tenant ID"
+ >
+ <Input
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="00000000-0000-0000-0000-000000000000"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.clientId"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Client ID"
+ >
+ <Input
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="00000000-0000-0000-0000-000000000000"
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.clientSecret"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Client Secret"
+ >
+ <SecretInput
+ placeholder="~JzD8e6S.tH~w8XRaNnKcb7W1fM4rCns7FY"
+ containerClassName="text-gray-400 group-focus-within:border-primary-400/50! border border-mineshaft-500 bg-mineshaft-900 px-2.5 py-1.5"
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </FormControl>
+ )}
+ />
+ <Controller
+ name="credentials.subscriptionId"
+ control={control}
+ shouldUnregister
+ render={({ field: { value, onChange }, fieldState: { error } }) => (
+ <FormControl
+ errorText={error?.message}
+ isError={Boolean(error?.message)}
+ label="Subscription ID"
+ >
+ <Input
+ value={value}
+ onChange={(e) => onChange(e.target.value)}
+ placeholder="00000000-0000-0000-0000-000000000000"
+ />
+ </FormControl>
+ )}
+ />
+ <div className="mt-8 flex items-center">
+ <Button
+ className="mr-4"
+ size="sm"
+ type="submit"
+ colorSchema="secondary"
+ isLoading={isSubmitting}
+ isDisabled={isSubmitting || !isDirty}
+ >
+ {isUpdate ? "Update Credentials" : "Connect to Azure DNS"}
+ </Button>
+ <ModalClose asChild>
+ <Button colorSchema="secondary" variant="plain">
+ Cancel
+ </Button>
+ </ModalClose>
+ </div>
+ </form>
+ </FormProvider>
+ );
+};