azure - 配置没有公共(public) URL 的 Azure 应用服务

标签 azure endpoint azure-web-app-service vnet sql-data-warehouse

我正在尝试从 Visual Studio 15.2 部署 Azure 应用服务。具体来说,我正在尝试部署以下服务:https://github.com/Microsoft/Azure-SQL-DB-auditing-OMS-integration将审计日志从 SQL 数据仓库提取到 OMS。但是,出于安全考虑,我们希望在不创建公共(public)端点(即 URL)的情况下执行此操作。我们已尝试在 VNet 中配置它,但除非 VNet 具有公共(public)网关,否则不允许您这样做。

最佳答案

Configure Azure App Service without public URL

据我所知,如果没有公共(public) URL,我们无法配置 Azure 应用服务。如果您创建了一个Web应用程序,它将自动提供公共(public)端点供用户访问。

这里有两个解决方法。

我发现 github 应用程序只使用网络应用程序的 webjobs。

一种方法:

如果您不需要任何网站,只需使用 backgourd 进程来运行 webjobs,您可以选择 azure function它使用 WebJobs SDK本身,但不需要为其配置应用服务。

第二种方式:

通常,我们在 Azure 应用服务 Web 应用中运行 WebJobs,并且可以通过 URL 访问/浏览该 Azure 应用服务 Web 应用。如果要阻止用户浏览到该 Azure 应用服务 Web 应用,可以将重写规则添加到站点的 web.config 中 block web access .

web.config是这样的:

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Block unauthorized traffic to staging sites" stopProcessing="true">
          <match url=".*" />
          <conditions>
            <!-- Enter your staging site host name here as the pattern-->
            <add input="{HTTP_HOST}" pattern=".*" />
            <!-- Enter your white listed IP addresses -->
            <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.1" negate="true"/>
            <!-- Add the white listed IP addresses with a new condition as seen below -->
            <!-- <add input="{REMOTE_ADDR}" pattern="123\.123\.123\.2" negate="true"/> -->

          </conditions>
          <action type="CustomResponse" statusCode="403" statusReason="Forbidden"
        statusDescription="Site is not accessible" />

        </rule>

      </rules>
    </rewrite>
  </system.webServer>

</configuration>

有关如何将 web.config 添加到您的网络应用程序的更多详细信息,您可以按照以下步骤操作:

1.在门户网站中打开 kudu 工具。

enter image description here

2.打开cmd控制台并找到\site\wwwroot文件夹。

enter image description here

3.创建web.config并复制其中的设置。

enter image description here

4.当我们访问该网站时,您可以发现:

enter image description here

关于azure - 配置没有公共(public) URL 的 Azure 应用服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45665989/

相关文章:

azure - wcf 和 azure appfabric 服务总线之间的区别?

java - 当 null 从未返回时,端点方法怎么可能返回 null?

python - 有没有办法为 random.uniform 设置开放和封闭端点?

Azure 网站和有状态 WebApp

.net - 使用 Windows Azure 从网站内部连接到具有 SQL Server 的虚拟机

asp.net-core - 启动 Azure 应用服务时出现间歇性问题 : "500.37 ANCM Failed to Start Within Startup Time Limit"

debugging - Azure远程调试: Failed to enable remote debuggingException from HRESULT: 0x89710023

azure - Azure TDE 使用的默认加密算法是什么?

azure - 如何更改 Azure Web App 上的默认“站点正在 build ”页面

azure - 多个 Azure CDN 端点