问题描述
我有一个仅供内部网络访问的URL。由于某些业务要求,必须可以从Azure APIM访问此URL。根据我从Microsoft文档https://docs.microsoft.com/en-us/azure/api-management/mock-api-responses
获得的屏幕截图,我称为端点的方式但是,我收到以下错误消息,因为只能从内部VPN访问myprivatedomain.com。我可以知道APIM如何执行测试API吗? (即IP地址是什么?等等。)谢谢。
HTTP / 1.1 400错误请求
content-length: 85
content-type: application/json
vary: Origin
{
"error": "The remote name Could not be resolved: 'myprivatedomain.com'"
}
解决方法
当API Management以内部虚拟网络模式部署时,所有服务端点仅在您控制访问权限的虚拟网络中可见。没有服务端点在公共DNS服务器上注册。
- 使用Azure门户启用虚拟网络连接
Update-AzApiManagementRegion
-ApiManagement <PsApiManagement>
-Location <String>
-Sku <PsApiManagementSku>
-Capacity <Int32>
[-VirtualNetwork <PsApiManagementVirtualNetwork>]
[-DefaultProfile <IAzureContextContainer>]
[<CommonParameters>]
3。对于内部虚拟网络模式,您必须管理自己的DNS。 您可以为所有服务端点设置自定义域名,如下图所示:
然后,您可以在DNS服务器中创建记录以访问只能从虚拟网络内访问的端点。
有关更多详细信息,您可以参考此article。