azure - 允许我的 Azure 应用服务与我的 Azure 虚拟机对话的最佳实践/方法

标签 azure azure-web-app-service azure-virtual-machine

我有一个没有公共(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.

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/

相关文章:

azure - Azure上的VM如何将公共(public)端口80映射到私有(private)端口8080

azure - 如何连接到 Azure Ubuntu VM 中 Docker 上托管的 SQL Server

asp.net-mvc - 构建面向完整 .net 框架的 VS2017 .net core 应用程序

azure - 何时使用机器人、FaaS、Runbook 和逻辑应用程序

azure - documentDB 中的 COUNT 不起作用

c# - 如何在单个应用程序中使用多个域? ASP.net core 3.0( Razor 页面, azure )

Azure PAM 未收到来自 ‎"Microsoft Graph data connect‎"数据工厂管道执行的特权访问请求

c# - CosmosDb 使用 insertMany 请求率很大

web-services - Azure Web App 响应时间较长

azure - 我可以在 IAAS 虚拟机上配置 Azure 诊断吗?