2024-06-26 15:45:06 -04:00
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
@ description ( ' The name of the API Management service instance ' )
param apiManagementName string = ' apiservice ${ uniqueString ( resourceGroup ( ) . id ) } '
@ description ( ' The email address of the owner of the service ' )
@ minLength ( 1 )
param publisherEmail string
@ description ( ' The name of the owner of the service ' )
@ minLength ( 1 )
param publisherName string
@ description ( ' The pricing tier of this API Management service ' )
@ allowed ( [
' Developer '
2024-08-07 09:51:56 -04:00
' StandardV2 '
2024-06-26 15:45:06 -04:00
] )
2024-08-07 09:51:56 -04:00
param sku string = ' Developer '
2024-06-26 15:45:06 -04:00
@ description ( ' The instance size of this API Management service. This should be a multiple of the number of availability zones getting deployed. ' )
2024-08-07 09:51:56 -04:00
param skuCount int = 1
2024-06-26 15:45:06 -04:00
@ description ( ' Application Insights resource name ' )
param appInsightsName string = ' apim-appi '
2024-07-15 16:42:22 -07:00
@ description ( ' Application Insights public network access for ingestion ' )
param appInsightsPublicNetworkAccessForIngestion string = ' Disabled '
2024-06-26 15:45:06 -04:00
@ description ( ' Azure region where the resources will be deployed ' )
param location string = resourceGroup ( ) . location
@ description ( ' Numbers for availability zones, for example, 1,2,3. ' )
param availabilityZones array = [
' 1 '
' 2 '
]
@ description ( ' Name for the public IP address used to access the API Management service. ' )
param publicIpName string = ' apimPublicIP '
@ description ( ' SKU for the public IP address used to access the API Management service. ' )
@ allowed ( [
' Standard '
] )
param publicIpSku string = ' Standard '
@ description ( ' Allocation method for the public IP address used to access the API Management service. Standard SKU public IP requires `Static` allocation. ' )
@ allowed ( [
' Static '
] )
param publicIPAllocationMethod string = ' Static '
@ description ( ' Unique DNS name for the public IP address used to access the API management service. ' )
param dnsLabelPrefix string = toLower ( ' ${ publicIpName } - ${ uniqueString ( resourceGroup ( ) . id ) } ' )
@ description ( ' The workspace id of the Log Analytics resource. ' )
param logAnalyticsWorkspaceId string
2024-08-09 22:22:49 -04:00
param restoreAPIM bool = false
2024-08-07 09:51:56 -04:00
param subnetId string
2024-06-26 15:45:06 -04:00
2024-08-07 09:51:56 -04:00
resource publicIp ' Microsoft.Network/publicIPAddresses@2024-01-01 ' = {
2024-06-26 15:45:06 -04:00
name : publicIpName
location : location
sku : {
name : publicIpSku
}
properties : {
publicIPAllocationMethod : publicIPAllocationMethod
publicIPAddressVersion : ' IPv4 '
dnsSettings : {
domainNameLabel : dnsLabelPrefix
}
}
}
2024-08-07 09:51:56 -04:00
resource apiManagementService ' Microsoft.ApiManagement/service@2023-09-01-preview ' = {
2024-06-26 15:45:06 -04:00
name : apiManagementName
location : location
sku : {
name : sku
capacity : skuCount
}
zones : ( ( length ( availabilityZones ) == 0 ) ? null : availabilityZones )
properties : {
2024-08-09 22:22:49 -04:00
restore : restoreAPIM
2024-06-26 15:45:06 -04:00
publisherEmail : publisherEmail
publisherName : publisherName
virtualNetworkType : ' External '
publicIpAddressId : publicIp . id
virtualNetworkConfiguration : {
2024-08-07 09:51:56 -04:00
subnetResourceId : subnetId
2024-06-26 15:45:06 -04:00
}
customProperties : {
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30 ' : ' false '
' Microsoft.WindowsAzure.ApiManagement.Gateway.Protocols.Server.Http2 ' : ' false '
}
}
}
2024-08-07 09:51:56 -04:00
resource apimLogger ' Microsoft.ApiManagement/service/loggers@2023-09-01-preview ' = {
2024-06-26 15:45:06 -04:00
name : appInsights . name
parent : apiManagementService
properties : {
resourceId : appInsights . id
description : ' Application Insights for APIM '
loggerType : ' applicationInsights '
credentials : {
instrumentationKey : appInsights . properties . InstrumentationKey
}
}
}
2024-08-07 09:51:56 -04:00
resource apimDiagnostics ' Microsoft.ApiManagement/service/diagnostics@2023-09-01-preview ' = {
2024-06-26 15:45:06 -04:00
name : ' applicationinsights '
parent : apiManagementService
properties : {
loggerId : apimLogger . id
alwaysLog : ' allErrors '
verbosity : ' information '
sampling : {
percentage : 100
samplingType : ' fixed '
}
}
}
resource appInsights ' Microsoft.Insights/components@2020-02-02 ' = {
name : appInsightsName
location : location
kind : ' web '
properties : {
Application_Type : ' web '
WorkspaceResourceId : logAnalyticsWorkspaceId
2024-07-15 16:42:22 -07:00
publicNetworkAccessForIngestion : appInsightsPublicNetworkAccessForIngestion
2024-06-26 15:45:06 -04:00
publicNetworkAccessForQuery : ' Enabled '
}
}
2024-08-07 09:51:56 -04:00
output name string = apiManagementService . name
output id string = apiManagementService . id
2024-06-26 15:45:06 -04:00
output apimGatewayUrl string = apiManagementService . properties . gatewayUrl
output appInsightsId string = appInsights . id
2024-07-15 16:42:22 -07:00
output appInsightsConnectionString string = appInsights . properties . ConnectionString