繁体   English   中英

Is it possible to allow Azure elastic jobs access to Azure SQL Databases without the need to allow all Azure resources to the server?

[英]Is it possible to allow Azure elastic jobs access to Azure SQL Databases without the need to allow all Azure resources to the server?

我们正在尝试使用 Azure 弹性作业在一组 Azure SQL 数据库上运行数据库作业。 对这些 Azure SQL 数据库的访问仅限于我们在防火墙规则中配置的某些 IP 地址。 在测试弹性作业的执行时,弹性作业代理无法访问我们的数据库。 我们不想为所有 Azure 服务启用访问权限。 我发现一个帖子可以通过手动添加我们使用位置的Azure资源的ip地址来限制访问。 https://github.com/MicrosoftDocs/azure-docs/issues/35138 )但这意味着该位置的所有 Azure 资源仍然可以尝试访问我们的服务器。

有没有办法只为我们的弹性作业 SQL 代理资源提供对我们 SQL 数据库的访问权限?

是的,不需要将所有 Azure 资源都允许到服务器,但之后我们需要将 ip 列入白名单。 ( https://github.com/MicrosoftDocs/azure-docs/issues/35138 ) as the post also said: Please go ahead to white list the IP Ranges for the specific data center you are deployed to instead of allowing all IPs from all Azure services.

我还创建了一个测试来证明这一点。
我关闭了我的 Azure SQL 数据库的这个设置。
在此处输入图像描述

然后我执行EXEC jobs.sp_start_job 'CreateTableTest'开始工作,我只得到如下错误: 在此处输入图像描述

所以我需要将客户端ip添加到我的Azure SQL数据库的防火墙规则中。 之后,它运行良好。 在此处输入图像描述

当我们允许 Azure 服务和资源访问该服务器时,它会自动隐式添加 azure 服务和资源的所有 ip 范围。

更新:
我已经删除了其他 IP 列表,弹性作业仍然可以成功运行。 在此处输入图像描述 太棒了! 在此处输入图像描述

在不将大量 ip 地址列入白名单或允许所有 azure 服务的情况下,我想出这样做的唯一方法是进行自动化作业,通过外部源进行查询,然后如果链接失败,则从地址中提取 Z957B527BCFBAD2E84355D88错误消息并将其添加到 sql 防火墙。

这远非理想,但至少更易于维护,并且可能更安全。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM