Я получил этот шаблон управления API ARM
{
"apiVersion": "2017-03-01",
"name": "[variables('am-apimanagement-service-name')]",
"type": "Microsoft.ApiManagement/service",
"location": "North Europe",
"sku": {
"name": "[parameters('am-sku')]",
"capacity": "[parameters('am-skuCount')]"
},
"properties": {
"publisherEmail": "[parameters('am-publisher-email-p')]",
"publisherName": "[parameters('am-publisher-name-p')]"
},
"resources": [
{
"type": "apis",
"apiVersion": "2017-03-01",
"name": "test",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service/',variables('am-apimanagement-service-name'))]"
],
"properties": {
"displayName": "test",
"description": "",
"serviceUrl": "[concat('https://test-',parameters('environment'),'.azurewebsites.net')]",
"path": "test",
"protocols": [
"https"
],
"isCurrent": true
},
"resources": [
{
"apiVersion": "2017-03-01",
"type": "operations",
"name": "GetTEst",
"dependsOn": [
"[concat('Microsoft.ApiManagement/service/', variables('am-apimanagement-service-name'), '/apis/test')]"
],
"properties": {
"displayName": "GET",
"method": "GET",
"urlTemplate": "/api/sites",
"description": "Get"
}
}
]
}
]
}
И этот шаблон ARM Web API
{
"apiVersion": "2016-03-01",
"name": "[variables('swa-name')]",
"type": "Microsoft.Web/sites",
"properties": {
"name": "[variables('swa-name')]",
"serverFarmId": "[variables('swa-hosting-plan-name')]",
"hostingEnvironment": "[parameters('swa-hosting-environment')]",
"siteConfig": {
"appSettings": [
{
"name": "Test:ConnectionString",
"value": "[concat('Server=tcp:', reference(resourceId('Microsoft.Sql/servers/', variables('db-serverName'))).fullyQualifiedDomainName, ',1433;Initial Catalog=', variables('db-databaseName'), ';Persist Security Info=False;User ID=', parameters('db-administratorLogin'), ';Password=', parameters('db-administratorLoginPassword'), ';MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;')]"
}
],
"ipSecurityRestrictions": [
{
"ipAddress": "[variables('test-ip-address')]",
"subnetMask": "255.255.255.255"
}
]
}
},
"location": "[parameters('swa-location')]",
"tags": {
},
"kind": "api",
"dependsOn": [
"[concat('Microsoft.Web/serverfarms/', variables('swa-hosting-plan-name'))]"
]
}
Как использовать справочную функцию для получения IP-адреса ресурса управления API из Web API? Я хочу поместить IP-адрес управления API в ipSecurityRestrictions. Я не могу понять это, и это немного расстраивает меня.
Я пробовал это из раздела ресурсов web api шаблона ARM:
"ipSecurityRestrictions": [
{
"ipAddress": "[variables('test-ip-address')]",
"subnetMask": "255.255.255.255"
},
{
"ipAddress": "[reference(variables('am-apimanagement-service-name')).publicIPAddresses[0]]",
"subnetMask": "255.255.255.255"
}
]
Но это не работает. Может быть, я не могу получить IP-адрес на этом этапе процесса? Я читаю о выводах и связанных шаблонах. Может быть, это решение?