-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi-management.bicep
83 lines (78 loc) · 3.15 KB
/
api-management.bicep
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
@description('Name of the resource.')
param name string
@description('Location to deploy the resource. Defaults to the location of the resource group.')
param location string = resourceGroup().location
@description('Tags for the resource.')
param tags object = {}
@description('ID for the Managed Identity associated with the API Management resource.')
param apiManagementIdentityId string
@export()
@description('Information about the configuration for a virtual network for the API Management service.')
type vnetConfigInfo = {
@description('Resource ID of a subnet for the API Management service.')
subnetResourceId: string
@description('Type of virtual network.')
virtualNetworkType: 'Internal' | 'External' | 'None'
}
@export()
@description('SKU information for API Management.')
type skuInfo = {
@description('Name of the SKU.')
name: 'Developer' | 'Standard' | 'Premium' | 'Basic' | 'Consumption' | 'Isolated' | 'BasicV2' | 'StandardV2'
@description('Capacity of the SKU.')
capacity: 1 | 2
}
@description('Email address of the owner for the API Management resource.')
@minLength(1)
param publisherEmail string
@description('Name of the owner for the API Management resource.')
@minLength(1)
param publisherName string
@description('API Management SKU. Defaults to Developer, capacity 1.')
param sku skuInfo = {
name: 'Developer'
capacity: 1
}
@description('Virtual network configuration for the API Management resource.')
param vnetConfig vnetConfigInfo = {
subnetResourceId: ''
virtualNetworkType: 'None'
}
@description('Certificates for the API Management resource.')
param certificates object[] = []
@description('Hostname configurations for the API Management resource.')
param hostnameConfigurations object[] = []
resource apiManagement 'Microsoft.ApiManagement/service@2023-09-01-preview' = {
name: name
location: location
tags: tags
sku: sku
identity: {
type: 'UserAssigned'
userAssignedIdentities: {
'${apiManagementIdentityId}': {}
}
}
properties: {
publisherEmail: publisherEmail
publisherName: publisherName
virtualNetworkConfiguration: !empty(vnetConfig.subnetResourceId)
? { subnetResourceId: vnetConfig.subnetResourceId }
: null
certificates: certificates
hostnameConfigurations: hostnameConfigurations
virtualNetworkType: !empty(vnetConfig.virtualNetworkType) ? vnetConfig.virtualNetworkType : 'None'
}
}
@description('The deployed API Management resource.')
output resource resource = apiManagement
@description('ID for the deployed API Management resource.')
output id string = apiManagement.id
@description('Name for the deployed API Management resource.')
output name string = apiManagement.name
@description('Gateway URL for the deployed API Management resource.')
output gatewayUrl string = apiManagement.properties.gatewayUrl
@description('Host for the deployed API Management resource.')
output host string = split(apiManagement.properties.gatewayUrl, '/')[2]
@description('Private IP address for the deployed API Management resource.')
output privateIp string = apiManagement.properties.privateIPAddresses[0]