我正在尝试从 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 工具。
2.打开cmd控制台并找到\site\wwwroot文件夹。
3.创建web.config并复制其中的设置。
4.当我们访问该网站时,您可以发现:
关于azure - 配置没有公共(public) URL 的 Azure 应用服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45665989/