我有一个没有公共(public) IP 的 Azure VM。它只有一个内部 IP,位于我的 Azure 上的“开发”环境虚拟网络中。我们将其称为虚拟网络 vnet-dev 上的 vm-dev。
我的 Azure VM 托管一个 Web API,该 API 在此虚拟机上的本地主机上的 IIS 上运行。我们称之为CoolWebApi
我有一个 Azure 应用服务,它是一个位于同一环境中的 API,我们将其称为 api-dev。
api-dev 有一个虚拟 IP 地址,我们称之为91.195.240.126
1) The only way anyone can get to vm-dev is by going through my Azure Firewall. They need a specific NAT rule to allow them access to that vm. For example, I might have a NAT rule that is like below.
block 引用>Source IP, Destination IP (Firewall Public IP), Translated Address, Port.
23.44.55.66, 23.674.23.12, 91.195.240.126 (vm-dev lives here), 3389.
The problem is, I want to allow my Azure App Service (api-dev) the ability to make requests to this VM on port 8080. So I think, I'll just make another NAT rule in the firewall and use the api-dev virtual IP / outbound addresses as the source IP, that will work right? Wrong.
I also tried to create inbound rules on my vnet-dev to allow the api-dev virtual ip on port 8080, 443, that also didn't work!
对此的最佳实践是什么?我应该做什么?
最终,api-dev 应该能够向运行在本地主机上的 vm-dev 上的 CoolWebApi 发出请求。
最佳答案
您需要在 Azure 防火墙中创建 DNAT 规则,其中源 IP 作为应用服务出站 IP,目标 IP 作为防火墙的公共(public) IP,目标端口作为“任何其他服务未使用的任何 IP”,并将端口转换为8080。
您不能对 2 个 DNAT 规则使用相同的目标端口。
当您创建 DNAT 规则时,会隐式创建入站规则,因此您不一定需要在此处创建网络规则。
关于azure - 允许我的 Azure 应用服务与我的 Azure 虚拟机对话的最佳实践/方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60049590/