Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions infra/apim/apim.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ param publisherName string
@description('The name of the App Insights workspace that this APIM will use')
param appInsightsName string

@description('The name of the Azure Redis Cache that will be used as the external cache for APIM')
param redisCacheName string

var apimName = 'apim-${baseName}-${environmentName}'
var loggerName = '${apimName}-logger'
var loggerDescription = 'APIM Logger for MCP Servers'
Expand All @@ -32,6 +35,10 @@ resource appInsights 'Microsoft.Insights/components@2020-02-02' existing = {
name: appInsightsName
}

resource redisCache 'Microsoft.Cache/redis@2024-11-01' existing = {
name: redisCacheName
}

resource apim 'Microsoft.ApiManagement/service@2024-06-01-preview' = {
name: apimName
location: location
Expand Down Expand Up @@ -60,6 +67,15 @@ resource apimLogger 'Microsoft.ApiManagement/service/loggers@2024-06-01-preview'
}
}

resource apimCache 'Microsoft.ApiManagement/service/caches@2024-06-01-preview' = {
name: 'apim-${redisCache.name}'
parent: apim
properties: {
connectionString: '${redisCache.properties.hostName}:${redisCache.properties.sslPort},password=${redisCache.listKeys().primaryKey},ssl=True,abortConnect=False'
useFromLocation: location
}
}

@description('The resource ID of the deployed APIM Service')
output id string = apim.id

Expand Down
37 changes: 37 additions & 0 deletions infra/cache/azureRedis.bicep
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@description('Base name used for all resources')
param baseName string

@description('The Azure region where this Azure Redis Cache resource will be deployed. Default is the resource group location')
param location string = resourceGroup().location

@description('The name of the environment that this Azure Redis Cache will be deployed to. Default value is "prod"')
@allowed([
'dev'
'test'
'prod'
])
param environmentName string = 'prod'

@description('The tags that will be applied to the Azure Redis Cache resource')
param tags object

var redisCacheName string = 'cache-${baseName}-${environmentName}'

resource redisCache 'Microsoft.Cache/redis@2024-11-01' = {
name: redisCacheName
location: location
tags: tags
properties: {
sku: {
name: 'Basic'
capacity: 0
family: 'C'
}
}
}

@description('The resource ID of the deployed Azure Redis Cache')
output id string = redisCache.id

@description('The name of the deployed Azure Redis Cache')
output name string = redisCache.name
10 changes: 10 additions & 0 deletions infra/deployMcpServer.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ module containerAppEnvironment 'host/containerAppEnvironment.bicep' = {
}
}

module redisCache 'cache/azureRedis.bicep' = {
scope: resourceGroup
name: 'redis'
params: {
tags: tags
baseName: baseName
}
}

module mcpEntraApp 'apim/mcp-entra-app.bicep' = {
scope: resourceGroup
name: 'mcpEntraApp'
Expand All @@ -75,6 +84,7 @@ module apim 'apim/apim.bicep' = {
baseName: baseName
emailAddress: emailAddress
publisherName: publisherName
redisCacheName: redisCache.outputs.name
}
}

Expand Down
Loading