Bringing the MCP server into the repo
This commit is contained in:
136
mcp-server/infra/abbreviations.json
Normal file
136
mcp-server/infra/abbreviations.json
Normal file
@@ -0,0 +1,136 @@
|
||||
{
|
||||
"analysisServicesServers": "as",
|
||||
"apiManagementService": "apim-",
|
||||
"appConfigurationStores": "appcs-",
|
||||
"appManagedEnvironments": "cae-",
|
||||
"appContainerApps": "ca-",
|
||||
"authorizationPolicyDefinitions": "policy-",
|
||||
"automationAutomationAccounts": "aa-",
|
||||
"blueprintBlueprints": "bp-",
|
||||
"blueprintBlueprintsArtifacts": "bpa-",
|
||||
"cacheRedis": "redis-",
|
||||
"cdnProfiles": "cdnp-",
|
||||
"cdnProfilesEndpoints": "cdne-",
|
||||
"cognitiveServicesAccounts": "cog-",
|
||||
"cognitiveServicesFormRecognizer": "cog-fr-",
|
||||
"cognitiveServicesTextAnalytics": "cog-ta-",
|
||||
"computeAvailabilitySets": "avail-",
|
||||
"computeCloudServices": "cld-",
|
||||
"computeDiskEncryptionSets": "des",
|
||||
"computeDisks": "disk",
|
||||
"computeDisksOs": "osdisk",
|
||||
"computeGalleries": "gal",
|
||||
"computeSnapshots": "snap-",
|
||||
"computeVirtualMachines": "vm",
|
||||
"computeVirtualMachineScaleSets": "vmss-",
|
||||
"containerInstanceContainerGroups": "ci",
|
||||
"containerRegistryRegistries": "cr",
|
||||
"containerServiceManagedClusters": "aks-",
|
||||
"databricksWorkspaces": "dbw-",
|
||||
"dataFactoryFactories": "adf-",
|
||||
"dataLakeAnalyticsAccounts": "dla",
|
||||
"dataLakeStoreAccounts": "dls",
|
||||
"dataMigrationServices": "dms-",
|
||||
"dBforMySQLServers": "mysql-",
|
||||
"dBforPostgreSQLServers": "psql-",
|
||||
"devicesIotHubs": "iot-",
|
||||
"devicesProvisioningServices": "provs-",
|
||||
"devicesProvisioningServicesCertificates": "pcert-",
|
||||
"documentDBDatabaseAccounts": "cosmos-",
|
||||
"documentDBMongoDatabaseAccounts": "cosmon-",
|
||||
"eventGridDomains": "evgd-",
|
||||
"eventGridDomainsTopics": "evgt-",
|
||||
"eventGridEventSubscriptions": "evgs-",
|
||||
"eventHubNamespaces": "evhns-",
|
||||
"eventHubNamespacesEventHubs": "evh-",
|
||||
"hdInsightClustersHadoop": "hadoop-",
|
||||
"hdInsightClustersHbase": "hbase-",
|
||||
"hdInsightClustersKafka": "kafka-",
|
||||
"hdInsightClustersMl": "mls-",
|
||||
"hdInsightClustersSpark": "spark-",
|
||||
"hdInsightClustersStorm": "storm-",
|
||||
"hybridComputeMachines": "arcs-",
|
||||
"insightsActionGroups": "ag-",
|
||||
"insightsComponents": "appi-",
|
||||
"keyVaultVaults": "kv-",
|
||||
"kubernetesConnectedClusters": "arck",
|
||||
"kustoClusters": "dec",
|
||||
"kustoClustersDatabases": "dedb",
|
||||
"logicIntegrationAccounts": "ia-",
|
||||
"logicWorkflows": "logic-",
|
||||
"machineLearningServicesWorkspaces": "mlw-",
|
||||
"managedIdentityUserAssignedIdentities": "id-",
|
||||
"managementManagementGroups": "mg-",
|
||||
"migrateAssessmentProjects": "migr-",
|
||||
"networkApplicationGateways": "agw-",
|
||||
"networkApplicationSecurityGroups": "asg-",
|
||||
"networkAzureFirewalls": "afw-",
|
||||
"networkBastionHosts": "bas-",
|
||||
"networkConnections": "con-",
|
||||
"networkDnsZones": "dnsz-",
|
||||
"networkExpressRouteCircuits": "erc-",
|
||||
"networkFirewallPolicies": "afwp-",
|
||||
"networkFirewallPoliciesWebApplication": "waf",
|
||||
"networkFirewallPoliciesRuleGroups": "wafrg",
|
||||
"networkFrontDoors": "fd-",
|
||||
"networkFrontdoorWebApplicationFirewallPolicies": "fdfp-",
|
||||
"networkLoadBalancersExternal": "lbe-",
|
||||
"networkLoadBalancersInternal": "lbi-",
|
||||
"networkLoadBalancersInboundNatRules": "rule-",
|
||||
"networkLocalNetworkGateways": "lgw-",
|
||||
"networkNatGateways": "ng-",
|
||||
"networkNetworkInterfaces": "nic-",
|
||||
"networkNetworkSecurityGroups": "nsg-",
|
||||
"networkNetworkSecurityGroupsSecurityRules": "nsgsr-",
|
||||
"networkNetworkWatchers": "nw-",
|
||||
"networkPrivateDnsZones": "pdnsz-",
|
||||
"networkPrivateLinkServices": "pl-",
|
||||
"networkPublicIPAddresses": "pip-",
|
||||
"networkPublicIPPrefixes": "ippre-",
|
||||
"networkRouteFilters": "rf-",
|
||||
"networkRouteTables": "rt-",
|
||||
"networkRouteTablesRoutes": "udr-",
|
||||
"networkTrafficManagerProfiles": "traf-",
|
||||
"networkVirtualNetworkGateways": "vgw-",
|
||||
"networkVirtualNetworks": "vnet-",
|
||||
"networkVirtualNetworksSubnets": "snet-",
|
||||
"networkVirtualNetworksVirtualNetworkPeerings": "peer-",
|
||||
"networkVirtualWans": "vwan-",
|
||||
"networkVpnGateways": "vpng-",
|
||||
"networkVpnGatewaysVpnConnections": "vcn-",
|
||||
"networkVpnGatewaysVpnSites": "vst-",
|
||||
"notificationHubsNamespaces": "ntfns-",
|
||||
"notificationHubsNamespacesNotificationHubs": "ntf-",
|
||||
"operationalInsightsWorkspaces": "log-",
|
||||
"portalDashboards": "dash-",
|
||||
"powerBIDedicatedCapacities": "pbi-",
|
||||
"purviewAccounts": "pview-",
|
||||
"recoveryServicesVaults": "rsv-",
|
||||
"resourcesResourceGroups": "rg-",
|
||||
"searchSearchServices": "srch-",
|
||||
"serviceBusNamespaces": "sb-",
|
||||
"serviceBusNamespacesQueues": "sbq-",
|
||||
"serviceBusNamespacesTopics": "sbt-",
|
||||
"serviceEndPointPolicies": "se-",
|
||||
"serviceFabricClusters": "sf-",
|
||||
"signalRServiceSignalR": "sigr",
|
||||
"sqlManagedInstances": "sqlmi-",
|
||||
"sqlServers": "sql-",
|
||||
"sqlServersDataWarehouse": "sqldw-",
|
||||
"sqlServersDatabases": "sqldb-",
|
||||
"sqlServersDatabasesStretch": "sqlstrdb-",
|
||||
"storageStorageAccounts": "st",
|
||||
"storageStorageAccountsVm": "stvm",
|
||||
"storSimpleManagers": "ssimp",
|
||||
"streamAnalyticsCluster": "asa-",
|
||||
"synapseWorkspaces": "syn",
|
||||
"synapseWorkspacesAnalyticsWorkspaces": "synw",
|
||||
"synapseWorkspacesSqlPoolsDedicated": "syndp",
|
||||
"synapseWorkspacesSqlPoolsSpark": "synsp",
|
||||
"timeSeriesInsightsEnvironments": "tsi-",
|
||||
"webServerFarms": "plan-",
|
||||
"webSitesAppService": "app-",
|
||||
"webSitesAppServiceEnvironment": "ase-",
|
||||
"webSitesFunctions": "func-",
|
||||
"webStaticSites": "stapp-"
|
||||
}
|
||||
47
mcp-server/infra/main.bicep
Normal file
47
mcp-server/infra/main.bicep
Normal file
@@ -0,0 +1,47 @@
|
||||
targetScope = 'subscription'
|
||||
|
||||
@minLength(1)
|
||||
@maxLength(64)
|
||||
@description('Name of the environment that can be used as part of naming resource convention')
|
||||
param environmentName string
|
||||
|
||||
@minLength(1)
|
||||
@description('Primary location for all resources')
|
||||
param location string
|
||||
|
||||
param mcpAwesomeCopilotExists bool
|
||||
|
||||
@description('Id of the user or app to assign application roles')
|
||||
param principalId string
|
||||
|
||||
// Tags that should be applied to all resources.
|
||||
//
|
||||
// Note that 'azd-service-name' tags should be applied separately to service host resources.
|
||||
// Example usage:
|
||||
// tags: union(tags, { 'azd-service-name': <service name in azure.yaml> })
|
||||
var tags = {
|
||||
'azd-env-name': environmentName
|
||||
}
|
||||
|
||||
// Organize resources in a resource group
|
||||
resource rg 'Microsoft.Resources/resourceGroups@2021-04-01' = {
|
||||
name: 'rg-${environmentName}'
|
||||
location: location
|
||||
tags: tags
|
||||
}
|
||||
|
||||
module resources 'resources.bicep' = {
|
||||
scope: rg
|
||||
name: 'resources'
|
||||
params: {
|
||||
location: location
|
||||
tags: tags
|
||||
principalId: principalId
|
||||
mcpAwesomeCopilotExists: mcpAwesomeCopilotExists
|
||||
}
|
||||
}
|
||||
|
||||
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = resources.outputs.AZURE_CONTAINER_REGISTRY_ENDPOINT
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_ID string = resources.outputs.AZURE_RESOURCE_MCP_AWESOME_COPILOT_ID
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_NAME string = resources.outputs.AZURE_RESOURCE_MCP_AWESOME_COPILOT_NAME
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_FQDN string = resources.outputs.AZURE_RESOURCE_MCP_AWESOME_COPILOT_FQDN
|
||||
18
mcp-server/infra/main.parameters.json
Normal file
18
mcp-server/infra/main.parameters.json
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#",
|
||||
"contentVersion": "1.0.0.0",
|
||||
"parameters": {
|
||||
"environmentName": {
|
||||
"value": "${AZURE_ENV_NAME}"
|
||||
},
|
||||
"location": {
|
||||
"value": "${AZURE_LOCATION}"
|
||||
},
|
||||
"mcpAwesomeCopilotExists": {
|
||||
"value": "${SERVICE_AWESOME_COPILOT_RESOURCE_EXISTS=false}"
|
||||
},
|
||||
"principalId": {
|
||||
"value": "${AZURE_PRINCIPAL_ID}"
|
||||
}
|
||||
}
|
||||
}
|
||||
8
mcp-server/infra/modules/fetch-container-image.bicep
Normal file
8
mcp-server/infra/modules/fetch-container-image.bicep
Normal file
@@ -0,0 +1,8 @@
|
||||
param exists bool
|
||||
param name string
|
||||
|
||||
resource existingApp 'Microsoft.App/containerApps@2023-05-02-preview' existing = if (exists) {
|
||||
name: name
|
||||
}
|
||||
|
||||
output containers array = exists ? existingApp.properties.template.containers : []
|
||||
144
mcp-server/infra/resources.bicep
Normal file
144
mcp-server/infra/resources.bicep
Normal file
@@ -0,0 +1,144 @@
|
||||
@description('The location used for all deployed resources')
|
||||
param location string = resourceGroup().location
|
||||
|
||||
@description('Tags that will be applied to all resources')
|
||||
param tags object = {}
|
||||
|
||||
param mcpAwesomeCopilotExists bool
|
||||
|
||||
@description('Id of the user or app to assign application roles')
|
||||
param principalId string
|
||||
|
||||
var abbrs = loadJsonContent('./abbreviations.json')
|
||||
var resourceToken = uniqueString(subscription().id, resourceGroup().id, location)
|
||||
|
||||
// Monitor application with Azure Monitor
|
||||
module monitoring 'br/public:avm/ptn/azd/monitoring:0.1.0' = {
|
||||
name: 'monitoring'
|
||||
params: {
|
||||
logAnalyticsName: '${abbrs.operationalInsightsWorkspaces}${resourceToken}'
|
||||
applicationInsightsName: '${abbrs.insightsComponents}${resourceToken}'
|
||||
applicationInsightsDashboardName: '${abbrs.portalDashboards}${resourceToken}'
|
||||
location: location
|
||||
tags: tags
|
||||
}
|
||||
}
|
||||
|
||||
// Container registry
|
||||
module containerRegistry 'br/public:avm/res/container-registry/registry:0.1.1' = {
|
||||
name: 'registry'
|
||||
params: {
|
||||
name: '${abbrs.containerRegistryRegistries}${resourceToken}'
|
||||
location: location
|
||||
tags: tags
|
||||
publicNetworkAccess: 'Enabled'
|
||||
roleAssignments: [
|
||||
{
|
||||
principalId: mcpAwesomeCopilotIdentity.outputs.principalId
|
||||
principalType: 'ServicePrincipal'
|
||||
// ACR pull role
|
||||
roleDefinitionIdOrName: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '7f951dda-4ed3-4680-a7ca-43fe172d538d')
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Container apps environment
|
||||
module containerAppsEnvironment 'br/public:avm/res/app/managed-environment:0.4.5' = {
|
||||
name: 'container-apps-environment'
|
||||
params: {
|
||||
logAnalyticsWorkspaceResourceId: monitoring.outputs.logAnalyticsWorkspaceResourceId
|
||||
name: '${abbrs.appManagedEnvironments}${resourceToken}'
|
||||
location: location
|
||||
zoneRedundant: false
|
||||
}
|
||||
}
|
||||
|
||||
// User assigned identity
|
||||
module mcpAwesomeCopilotIdentity 'br/public:avm/res/managed-identity/user-assigned-identity:0.2.1' = {
|
||||
name: 'mcpAwesomeCopilotIdentity'
|
||||
params: {
|
||||
name: '${abbrs.managedIdentityUserAssignedIdentities}mcpawesomecopilot-${resourceToken}'
|
||||
location: location
|
||||
}
|
||||
}
|
||||
|
||||
// Azure Container Apps
|
||||
module mcpAwesomeCopilotFetchLatestImage './modules/fetch-container-image.bicep' = {
|
||||
name: 'mcpAwesomeCopilot-fetch-image'
|
||||
params: {
|
||||
exists: mcpAwesomeCopilotExists
|
||||
name: 'awesome-copilot'
|
||||
}
|
||||
}
|
||||
|
||||
module mcpAwesomeCopilot 'br/public:avm/res/app/container-app:0.8.0' = {
|
||||
name: 'mcpAwesomeCopilot'
|
||||
params: {
|
||||
name: 'awesome-copilot'
|
||||
ingressTargetPort: 8080
|
||||
scaleMinReplicas: 1
|
||||
scaleMaxReplicas: 10
|
||||
secrets: {
|
||||
secureList: [
|
||||
]
|
||||
}
|
||||
containers: [
|
||||
{
|
||||
image: mcpAwesomeCopilotFetchLatestImage.outputs.?containers[?0].?image ?? 'mcr.microsoft.com/azuredocs/containerapps-helloworld:latest'
|
||||
name: 'main'
|
||||
resources: {
|
||||
cpu: json('0.5')
|
||||
memory: '1.0Gi'
|
||||
}
|
||||
env: [
|
||||
{
|
||||
name: 'APPLICATIONINSIGHTS_CONNECTION_STRING'
|
||||
value: monitoring.outputs.applicationInsightsConnectionString
|
||||
}
|
||||
{
|
||||
name: 'AZURE_CLIENT_ID'
|
||||
value: mcpAwesomeCopilotIdentity.outputs.clientId
|
||||
}
|
||||
{
|
||||
name: 'PORT'
|
||||
value: '8080'
|
||||
}
|
||||
]
|
||||
args: [
|
||||
'--http'
|
||||
]
|
||||
}
|
||||
]
|
||||
managedIdentities: {
|
||||
systemAssigned: false
|
||||
userAssignedResourceIds: [
|
||||
mcpAwesomeCopilotIdentity.outputs.resourceId
|
||||
]
|
||||
}
|
||||
registries: [
|
||||
{
|
||||
server: containerRegistry.outputs.loginServer
|
||||
identity: mcpAwesomeCopilotIdentity.outputs.resourceId
|
||||
}
|
||||
]
|
||||
environmentResourceId: containerAppsEnvironment.outputs.resourceId
|
||||
corsPolicy: {
|
||||
allowedOrigins: [
|
||||
'https://make.preview.powerapps.com'
|
||||
'https://make.powerapps.com'
|
||||
'https://make.preview.powerautomate.com'
|
||||
'https://make.powerautomate.com'
|
||||
'https://copilotstudio.preview.microsoft.com'
|
||||
'https://copilotstudio.microsoft.com'
|
||||
]
|
||||
}
|
||||
location: location
|
||||
tags: union(tags, { 'azd-service-name': 'awesome-copilot' })
|
||||
}
|
||||
}
|
||||
|
||||
output AZURE_CONTAINER_REGISTRY_ENDPOINT string = containerRegistry.outputs.loginServer
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_ID string = mcpAwesomeCopilot.outputs.resourceId
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_NAME string = mcpAwesomeCopilot.outputs.name
|
||||
output AZURE_RESOURCE_MCP_AWESOME_COPILOT_FQDN string = mcpAwesomeCopilot.outputs.fqdn
|
||||
Reference in New Issue
Block a user