Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
improvement: add support for gateways on azure key vault
adilson316000d2c571
diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.tsindex e38835b3e4..621cd57e03 100644--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-fns.ts@@ -1,9 +1,18 @@/* eslint-disable no-case-declarations */-import { AxiosError, AxiosResponse } from "axios";+import { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";+import https from "https";+import { verifyHostInputValidity } from "@app/ee/services/dynamic-secret/dynamic-secret-fns";+import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";import { getConfig } from "@app/lib/config/env";import { request } from "@app/lib/config/request";import { BadRequestError, InternalServerError, NotFoundError } from "@app/lib/errors";+import { GatewayProxyProtocol, withGatewayProxy } from "@app/lib/gateway";+import { withGatewayV2Proxy } from "@app/lib/gateway-v2/gateway-v2";+import { logger } from "@app/lib/logger";+import { blockLocalAndPrivateIpAddresses } from "@app/lib/validator";import {decryptAppConnectionCredentials,encryptAppConnectionCredentials,@@ -24,6 +33,148 @@ import {TAzureKeyVaultConnectionCredentials} from "./azure-key-vault-connection-types";+/**+ * Proxies an Azure Key Vault data-plane request through a gateway when the connection has one+ * configured, otherwise sends it directly. Mirrors `requestWithHCVaultGateway`.+ *+ * Note: this is only for vault data-plane calls (e.g. https://<vault>.vault.azure.net), which can+ * sit behind an Azure Private Link. Azure AD token requests (login.microsoftonline.com) are public+ * and are not routed through the gateway.+ */+export const requestWithAzureKeyVaultGateway = async <T>(+ connection: { gatewayId?: string | null; gatewayPoolId?: string | null },+ gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">,+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">,+ requestConfig: AxiosRequestConfig,+ gatewayPoolService?: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">+): Promise<AxiosResponse<T>> => {+ const { gatewayId: directGatewayId, gatewayPoolId } = connection;++ if (gatewayPoolId && !gatewayPoolService) {+ throw new BadRequestError({+ message: "Pool-backed connections require gatewayPoolService at the call site"+ });+ }++ const gatewayId =+ gatewayPoolId && gatewayPoolService+ ? await gatewayPoolService.resolveEffectiveGatewayId({ gatewayId: directGatewayId, gatewayPoolId })+ : directGatewayId;++ const url = new URL(requestConfig.url as string);+ await blockLocalAndPrivateIpAddresses(url.toString(), Boolean(gatewayId));++ // If gateway isn't set up, don't proxy the request+ if (!gatewayId) {+ return request.request(requestConfig);+ }++ const [targetHost] = await verifyHostInputValidity({ host: url.hostname, isGateway: true, isDynamicSecret: false });+ // port is empty string when using the protocol's default port (443 for https, 80 for http)+ // eslint-disable-next-line no-nested-ternary+ const targetPort = url.port ? Number(url.port) : url.protocol === "https:" ? 443 : 80;++ // try gateway v2 first, then fall back to gateway v1+ const gatewayConnectionDetailsV2 = await gatewayV2Service.getPlatformConnectionDetailsByGatewayId({+ gatewayId,+ targetHost,+ targetPort+ });++ if (gatewayConnectionDetailsV2) {+ return withGatewayV2Proxy(+ async (proxyPort) => {+ const isHttps = url.protocol === "https:";++ url.host = `localhost:${proxyPort}`;++ const finalRequestConfig: AxiosRequestConfig = {+ ...requestConfig,+ url: url.toString(),+ headers: {+ ...requestConfig.headers,+ Host: targetHost+ },+ ...(isHttps && {+ httpsAgent: new https.Agent({+ servername: targetHost+ })+ })+ };++ try {+ return await request.request(finalRequestConfig);+ } catch (error) {+ if (error instanceof AxiosError) {+ logger.error(+ {+ error,+ message: error.message,+ data: (error.response as undefined | { data: unknown })?.data,+ url: url.toString()+ },+ "Error during Azure Key Vault gateway v2 request:"+ );+ }+ throw error;+ }+ },+ {+ protocol: GatewayProxyProtocol.Tcp,+ relayHost: gatewayConnectionDetailsV2.relayHost,+ gateway: gatewayConnectionDetailsV2.gateway,+ relay: gatewayConnectionDetailsV2.relay+ }+ );+ }++ const gatewayConnectionDetailsV1 = await gatewayService.fnGetGatewayClientTlsByGatewayId(gatewayId);++ return withGatewayProxy(+ async (proxyPort) => {+ const httpsAgent = new https.Agent({+ servername: targetHost+ });++ url.protocol = "https:";+ url.host = `localhost:${proxyPort}`;++ const finalRequestConfig: AxiosRequestConfig = {+ ...requestConfig,+ url: url.toString(),+ httpsAgent,+ headers: {+ ...requestConfig.headers,+ Host: targetHost+ }+ };++ try {+ return await request.request(finalRequestConfig);+ } catch (error) {+ if (error instanceof AxiosError) {+ logger.error(+ {+ error,+ message: error.message,+ data: (error.response as undefined | { data: unknown })?.data,+ url: url.toString()+ },+ "Error during Azure Key Vault gateway v1 request:"+ );+ }+ throw error;+ }+ },+ {+ relayDetails: gatewayConnectionDetailsV1,+ protocol: GatewayProxyProtocol.Tcp,+ targetHost,+ targetPort+ }+ );+};+export const getAzureConnectionAccessToken = async (connectionId: string,appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">,diff --git a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.tsindex 9e8c61ad2c..c1b5f020a9 100644--- a/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts+++ b/backend/src/services/app-connection/azure-key-vault/azure-key-vault-connection-schemas.ts@@ -99,7 +99,10 @@ export const ValidateAzureKeyVaultConnectionCredentialsSchema = z.discriminatedU]);export const CreateAzureKeyVaultConnectionSchema = ValidateAzureKeyVaultConnectionCredentialsSchema.and(- GenericCreateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, { supportsCredentialRotation: true })+ GenericCreateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, {+ supportsCredentialRotation: true,+ supportsGateways: true+ }));export const UpdateAzureKeyVaultConnectionSchema = z@@ -113,7 +116,12 @@ export const UpdateAzureKeyVaultConnectionSchema = z.optional().describe(AppConnections.UPDATE(AppConnection.AzureKeyVault).credentials)})- .and(GenericUpdateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, { supportsCredentialRotation: true }));+ .and(+ GenericUpdateAppConnectionFieldsSchema(AppConnection.AzureKeyVault, {+ supportsCredentialRotation: true,+ supportsGateways: true+ })+ );const BaseAzureKeyVaultConnectionSchema = BaseAppConnectionSchema.extend({app: z.literal(AppConnection.AzureKeyVault)diff --git a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.tsindex 2554f4c522..aee8326090 100644--- a/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts+++ b/backend/src/services/secret-sync/azure-key-vault/azure-key-vault-sync-fns.ts@@ -1,9 +1,14 @@/* eslint-disable no-await-in-loop */import { AxiosError } from "axios";-import { request } from "@app/lib/config/request";+import { TGatewayServiceFactory } from "@app/ee/services/gateway/gateway-service";+import { TGatewayPoolServiceFactory } from "@app/ee/services/gateway-pool/gateway-pool-service";+import { TGatewayV2ServiceFactory } from "@app/ee/services/gateway-v2/gateway-v2-service";import { TAppConnectionDALFactory } from "@app/services/app-connection/app-connection-dal";-import { getAzureConnectionAccessToken } from "@app/services/app-connection/azure-key-vault/azure-key-vault-connection-fns";+import {+ getAzureConnectionAccessToken,+ requestWithAzureKeyVaultGateway+} from "@app/services/app-connection/azure-key-vault/azure-key-vault-connection-fns";import { TKmsServiceFactory } from "@app/services/kms/kms-service";import { matchesSchema } from "@app/services/secret-sync/secret-sync-fns";import { TSecretMap } from "@app/services/secret-sync/secret-sync-types";@@ -14,14 +19,27 @@ import { GetAzureKeyVaultSecret, TAzureKeyVaultSyncWithCredentials } from "./azutype TAzureKeyVaultSyncFactoryDeps = {appConnectionDAL: Pick<TAppConnectionDALFactory, "findById" | "updateById">;kmsService: Pick<TKmsServiceFactory, "createCipherPairWithDataKey">;+ gatewayService: Pick<TGatewayServiceFactory, "fnGetGatewayClientTlsByGatewayId">;+ gatewayV2Service: Pick<TGatewayV2ServiceFactory, "getPlatformConnectionDetailsByGatewayId">;+ gatewayPoolService: Pick<TGatewayPoolServiceFactory, "resolveEffectiveGatewayId">;};+// the effective gateway is resolved up front, so callers thread a connection that only carries a gatewayId+type TGatewayConnection = { gatewayId?: string | null; gatewayPoolId?: string | null };+const AZURE_KEY_VAULT_CERTIFICATE_CONTENT_TYPES = ["application/x-pkcs12", "application/x-pem-file"];-export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzureKeyVaultSyncFactoryDeps) => {+export const azureKeyVaultSyncFactory = ({+ kmsService,+ appConnectionDAL,+ gatewayService,+ gatewayV2Service,+ gatewayPoolService+}: TAzureKeyVaultSyncFactoryDeps) => {const $getAzureKeyVaultSecrets = async (accessToken: string,vaultBaseUrl: string,+ gatewayConnection: TGatewayConnection,{ disableCertificateImport = false }: { disableCertificateImport?: boolean } = {}) => {const paginateAzureKeyVaultSecrets = async () => {@@ -30,11 +48,18 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurlet currentUrl = `${vaultBaseUrl}/secrets?api-version=7.3`;while (currentUrl) {- const res = await request.get<{ value: GetAzureKeyVaultSecret; nextLink: string }>(currentUrl, {- headers: {- Authorization: `Bearer ${accessToken}`+ const res = await requestWithAzureKeyVaultGateway<{ value: GetAzureKeyVaultSecret; nextLink: string }>(+ gatewayConnection,+ gatewayService,+ gatewayV2Service,+ {+ method: "GET",+ url: currentUrl,+ headers: {+ Authorization: `Bearer ${accessToken}`+ }}- });+ );result = result.concat(res.data.value);currentUrl = res.data.nextLink;@@ -70,9 +95,13 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurlastSlashIndex = getAzureKeyVaultSecret.id.lastIndexOf("/");}- const azureKeyVaultSecret = await request.get<GetAzureKeyVaultSecret>(- `${getAzureKeyVaultSecret.id}?api-version=7.3`,+ const azureKeyVaultSecret = await requestWithAzureKeyVaultGateway<GetAzureKeyVaultSecret>(+ gatewayConnection,+ gatewayService,+ gatewayV2Service,{+ method: "GET",+ url: `${getAzureKeyVaultSecret.id}?api-version=7.3`,headers: {Authorization: `Bearer ${accessToken}`}@@ -100,11 +129,20 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzur};const syncSecrets = async (secretSync: TAzureKeyVaultSyncWithCredentials, secretMap: TSecretMap) => {- const { accessToken } = await getAzureConnectionAccessToken(secretSync.connection.id, appConnectionDAL, kmsService);+ const { connection } = secretSync;++ const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({+ gatewayId: connection.gatewayId,+ gatewayPoolId: connection.gatewayPoolId+ });+ const gatewayConnection: TGatewayConnection = { gatewayId: effectiveGatewayId, gatewayPoolId: null };++ const { accessToken } = await getAzureConnectionAccessToken(connection.id, appConnectionDAL, kmsService);const { vaultSecrets, disabledAzureKeyVaultSecretKeys } = await $getAzureKeyVaultSecrets(accessToken,secretSync.destinationConfig.vaultBaseUrl,+ gatewayConnection,{ disableCertificateImport: secretSync.syncOptions.disableCertificateImport });@@ -148,17 +186,16 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurwhile (!isSecretSet && maxTries > 0) {// try to set secrettry {- await request.put(- `${secretSync.destinationConfig.vaultBaseUrl}/secrets/${key}?api-version=7.3`,- {+ await requestWithAzureKeyVaultGateway(gatewayConnection, gatewayService, gatewayV2Service, {+ method: "PUT",+ url: `${secretSync.destinationConfig.vaultBaseUrl}/secrets/${key}?api-version=7.3`,+ data: {value},- {- headers: {- Authorization: `Bearer ${accessToken}`- }+ headers: {+ Authorization: `Bearer ${accessToken}`}- );+ });isSecretSet = true;} catch (err) {@@ -166,15 +203,14 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurif (err instanceof AxiosError) {// eslint-disable-next-lineif (err.response?.data?.error?.innererror?.code === "ObjectIsDeletedButRecoverable") {- await request.post(- `${secretSync.destinationConfig.vaultBaseUrl}/deletedsecrets/${key}/recover?api-version=7.3`,- {},- {- headers: {- Authorization: `Bearer ${accessToken}`- }+ await requestWithAzureKeyVaultGateway(gatewayConnection, gatewayService, gatewayV2Service, {+ method: "POST",+ url: `${secretSync.destinationConfig.vaultBaseUrl}/deletedsecrets/${key}/recover?api-version=7.3`,+ data: {},+ headers: {+ Authorization: `Bearer ${accessToken}`}- );+ });await new Promise((resolve) => {setTimeout(resolve, 10_000);@@ -212,7 +248,9 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurmatchesSchema(secret, secretSync.environment?.slug || "", secretSync.syncOptions.keySchema) &&!setSecrets.find((setSecret) => setSecret.key === secret))) {- await request.delete(`${secretSync.destinationConfig.vaultBaseUrl}/secrets/${deleteSecretKey}?api-version=7.3`, {+ await requestWithAzureKeyVaultGateway(gatewayConnection, gatewayService, gatewayV2Service, {+ method: "DELETE",+ url: `${secretSync.destinationConfig.vaultBaseUrl}/secrets/${deleteSecretKey}?api-version=7.3`,headers: {Authorization: `Bearer ${accessToken}`}@@ -221,11 +259,20 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzur};const removeSecrets = async (secretSync: TAzureKeyVaultSyncWithCredentials, secretMap: TSecretMap) => {- const { accessToken } = await getAzureConnectionAccessToken(secretSync.connection.id, appConnectionDAL, kmsService);+ const { connection } = secretSync;++ const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({+ gatewayId: connection.gatewayId,+ gatewayPoolId: connection.gatewayPoolId+ });+ const gatewayConnection: TGatewayConnection = { gatewayId: effectiveGatewayId, gatewayPoolId: null };++ const { accessToken } = await getAzureConnectionAccessToken(connection.id, appConnectionDAL, kmsService);const { vaultSecrets, disabledAzureKeyVaultSecretKeys } = await $getAzureKeyVaultSecrets(accessToken,secretSync.destinationConfig.vaultBaseUrl,+ gatewayConnection,{ disableCertificateImport: secretSync.syncOptions.disableCertificateImport });@@ -234,7 +281,9 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzurif (underscoredKey in secretMap) {if (!disabledAzureKeyVaultSecretKeys.includes(underscoredKey)) {- await request.delete(`${secretSync.destinationConfig.vaultBaseUrl}/secrets/${key}?api-version=7.3`, {+ await requestWithAzureKeyVaultGateway(gatewayConnection, gatewayService, gatewayV2Service, {+ method: "DELETE",+ url: `${secretSync.destinationConfig.vaultBaseUrl}/secrets/${key}?api-version=7.3`,headers: {Authorization: `Bearer ${accessToken}`}@@ -245,11 +294,20 @@ export const azureKeyVaultSyncFactory = ({ kmsService, appConnectionDAL }: TAzur};const getSecrets = async (secretSync: TAzureKeyVaultSyncWithCredentials) => {- const { accessToken } = await getAzureConnectionAccessToken(secretSync.connection.id, appConnectionDAL, kmsService);+ const { connection } = secretSync;++ const effectiveGatewayId = await gatewayPoolService.resolveEffectiveGatewayId({+ gatewayId: connection.gatewayId,+ gatewayPoolId: connection.gatewayPoolId+ });+ const gatewayConnection: TGatewayConnection = { gatewayId: effectiveGatewayId, gatewayPoolId: null };++ const { accessToken } = await getAzureConnectionAccessToken(connection.id, appConnectionDAL, kmsService);const { vaultSecrets, disabledAzureKeyVaultSecretKeys } = await $getAzureKeyVaultSecrets(accessToken,secretSync.destinationConfig.vaultBaseUrl,+ gatewayConnection,{ disableCertificateImport: secretSync.syncOptions.disableCertificateImport });diff --git a/backend/src/services/secret-sync/secret-sync-fns.ts b/backend/src/services/secret-sync/secret-sync-fns.tsindex a297089bf3..951b762a82 100644--- a/backend/src/services/secret-sync/secret-sync-fns.ts+++ b/backend/src/services/secret-sync/secret-sync-fns.ts@@ -316,7 +316,10 @@ export const SecretSyncFns = {case SecretSync.AzureKeyVault:return azureKeyVaultSyncFactory({appConnectionDAL,- kmsService+ kmsService,+ gatewayService,+ gatewayV2Service,+ gatewayPoolService}).syncSecrets(secretSync, schemaSecretMap);case SecretSync.AzureAppConfiguration:return azureAppConfigurationSyncFactory({@@ -442,7 +445,10 @@ export const SecretSyncFns = {case SecretSync.AzureKeyVault:secretMap = await azureKeyVaultSyncFactory({appConnectionDAL,- kmsService+ kmsService,+ gatewayService,+ gatewayV2Service,+ gatewayPoolService}).getSecrets(secretSync);break;case SecretSync.AzureAppConfiguration:@@ -602,7 +608,10 @@ export const SecretSyncFns = {case SecretSync.AzureKeyVault:return azureKeyVaultSyncFactory({appConnectionDAL,- kmsService+ kmsService,+ gatewayService,+ gatewayV2Service,+ gatewayPoolService}).removeSecrets(secretSync, schemaSecretMap);case SecretSync.AzureAppConfiguration:return azureAppConfigurationSyncFactory({diff --git a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsxindex 10942756a5..4403c4d47c 100644--- a/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx+++ b/frontend/src/components/v3/platform/GatewayPicker/GatewayPicker.tsx@@ -83,7 +83,7 @@ export const GatewayPicker = ({<SelectTrigger className={className ?? "w-full"} isError={isError}><SelectValue placeholder={placeholder ?? "Select gateway..."} /></SelectTrigger>- <SelectContent position="popper">+ <SelectContent position="popper" className="z-[100]">{!isRequired && (<SelectItem value="internet"><span className="flex items-center gap-2">diff --git a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsxindex 6166d3c135..5f2a0cbc92 100644--- a/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx+++ b/frontend/src/pages/organization/AppConnections/AppConnectionsPage/components/AppConnectionForm/AzureKeyVaultConnectionForm.tsx@@ -5,6 +5,7 @@ import { Controller, FormProvider, useForm } from "react-hook-form";import { zodResolver } from "@hookform/resolvers/zod";import { z } from "zod";+import { OrgPermissionCan } from "@app/components/permissions";import {Button,FormControl,@@ -12,8 +13,15 @@ import {ModalClose,SecretInput,Select,- SelectItem+ SelectItem,+ Tooltip} from "@app/components/v2";+import { GatewayPicker } from "@app/components/v3/platform/GatewayPicker";+import { useSubscription } from "@app/context";+import {+ OrgGatewayPermissionActions,+ OrgPermissionSubjects+} from "@app/context/OrgPermissionContext/types";import {APP_CONNECTION_MAP,getAppConnectionMethodDetails,@@ -97,7 +105,9 @@ const getDefaultValues = (appConnection?: TAzureKeyVaultConnection): Partial<Forapp: AppConnection.AzureKeyVault,method: AzureKeyVaultConnectionMethod.OAuth,isAutoRotationEnabled: false,- rotation: defaultRotation+ rotation: defaultRotation,+ gatewayId: null,+ gatewayPoolId: null};}@@ -107,7 +117,9 @@ const getDefaultValues = (appConnection?: TAzureKeyVaultConnection): Partial<Forapp: appConnection.app,method: appConnection.method,isAutoRotationEnabled: appConnection.isAutoRotationEnabled,- rotation: appConnection.rotation ?? defaultRotation+ rotation: appConnection.rotation ?? defaultRotation,+ gatewayId: appConnection.gatewayId,+ gatewayPoolId: appConnection.gatewayPoolId};const { credentials } = appConnection;@@ -174,11 +186,16 @@ export const AzureKeyVaultConnectionForm = ({ appConnection, onSubmit, projectIdconst {handleSubmit,control,+ setValue,watch,formState: { isSubmitting, isDirty }} = form;const selectedMethod = watch("method");+ const gatewayId = watch("gatewayId");+ const gatewayPoolId = watch("gatewayPoolId");++ const { subscription } = useSubscription();const onSubmitHandler = async (formData: FormData) => {const state = crypto.randomBytes(16).toString("hex");@@ -274,6 +291,33 @@ export const AzureKeyVaultConnectionForm = ({ appConnection, onSubmit, projectId)}/>+ {subscription.gateway && (+ <OrgPermissionCan+ I={OrgGatewayPermissionActions.AttachGateways}+ a={OrgPermissionSubjects.Gateway}+ >+ {(isAllowed) => (+ <FormControl label="Gateway">+ <Tooltip+ isDisabled={isAllowed}+ content="Restricted access. You don't have permission to attach gateways to resources."+ >+ <div>+ <GatewayPicker+ isDisabled={!isAllowed}+ value={{ gatewayId: gatewayId ?? null, gatewayPoolId: gatewayPoolId ?? null }}+ onChange={({ gatewayId: newGwId, gatewayPoolId: newPoolId }) => {+ setValue("gatewayId", newGwId, { shouldDirty: true });+ setValue("gatewayPoolId", newPoolId, { shouldDirty: true });+ }}+ />+ </div>+ </Tooltip>+ </FormControl>+ )}+ </OrgPermissionCan>+ )}+{selectedMethod === AzureKeyVaultConnectionMethod.OAuth && (<Controllername="tenantId"diff --git a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsxindex 6575a07805..319b1730f7 100644--- a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx+++ b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.tsx@@ -144,7 +144,8 @@ export const OAuthCallbackPage = () => {clearState(AppConnection.AzureKeyVault);- const { connectionId, name, description, returnUrl, projectId } = formData;+ const { connectionId, name, description, returnUrl, projectId, gatewayId, gatewayPoolId } =+ formData;let connection: TAppConnection;@@ -156,7 +157,9 @@ export const OAuthCallbackPage = () => {credentials: {code: code as string,tenantId: formData.tenantId- }+ },+ gatewayId,+ gatewayPoolId});} else {connection = await createAppConnection.mutateAsync({@@ -168,7 +171,9 @@ export const OAuthCallbackPage = () => {credentials: {tenantId: formData.tenantId,code: code as string- }+ },+ gatewayId,+ gatewayPoolId});}} catch {diff --git a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.types.ts b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.types.tsindex e2e5e3d681..f99b9cbacd 100644--- a/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.types.ts+++ b/frontend/src/pages/organization/AppConnections/OauthCallbackPage/OauthCallbackPage.types.ts@@ -28,7 +28,10 @@ export type GitLabFormData = BaseFormData &Pick<TGitLabConnection, "name" | "method" | "description" | "credentials">;export type AzureKeyVaultFormData = BaseFormData &- Pick<TAzureKeyVaultConnection, "name" | "method" | "description"> &+ Pick<+ TAzureKeyVaultConnection,+ "name" | "method" | "description" | "gatewayId" | "gatewayPoolId"+ > &Pick<TAzureKeyVaultConnection["credentials"], "tenantId">;export type AzureAppConfigurationFormData = BaseFormData &