Azure Pipeline 在没有公共访问权限的服务器上运行 SQL

发布于 2025-01-09 20:08:29 字数 364 浏览 2 评论 0原文

我们在 azure 中有一个 SQL 实例,直到最近才公开可用,并且根据 IP 白名单限制访问。我们最近勾选了“拒绝公共访问”复选框并为服务器设置了专用端点。

我们还在 azure devops 中构建和发布管道,它创建一个 SQL 实体框架迁移文件作为构建的一部分,并使用管理员凭据针对 SQL 运行它作为发布的一部分,这意味着我们可以在没有应用程序的情况下在数据库上应用迁移需要对数据库有超过基本的读/写访问权限。

我们遇到的问题是,当版本需要对数据库执行 SQL 时,它无法连接,我认为是因为构建代理位于我们的 vnet 之外。

我们正在考虑在 vnet 内创建我们自己的构建代理,并将其用于构建和构建。发布管道,我们有信心这将解决问题,但希望有其他选择(如果有)?

We have a SQL instance in azure which until recently was publicly available with access restricted based on IP whitelisting. We have recently ticked the "Deny public access" checkbox and set up private endpoints for the server.

We also have build and release pipelines in azure devops which create a SQL entity framework migration file as part of the build and run it against SQL as part of the release using admin credentials, this means that we can apply migrations on the database without the app needing to have more than basic read/write access to the database.

The problem that we have encountered is that when the release gets to the point of needing to execute the SQL against the database it cannot connect, I assume because the build agent is outside of our vnet.

We are looking at creating our own build agent inside the vnet and using this for the build & release pipelines, we are confident that this will resolve the issue but would like other options if there are any?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人问我粥可暖 2025-01-16 20:08:29

谢谢5NRFRyu S.。将您的讨论作为答案发布以帮助其他社区成员。

您可以尝试这些可能的解决方案中的任何一个。

  1. 在 SQL Server 虚拟机上创建自托管代理,该虚拟机将成为 VNet 的一部分。
  2. 在连接同一 VNet 的 Azure 虚拟机上创建自托管代理
  3. 在本地计算机上创建自托管代理。使用快速路由、专用对等互连或 VPN 隧道连接到专用
    端点。

通过设置在自托管代理上运行构建和管道

参考:c创建自我托管代理通过 VPN 从本地环境进行连接

Thank you 5NRF and Ryu S.. Posting your discussions as answer to help other community members.

You could try anyone of these possible solutions.

  1. Create self-hosted agent on the SQL server VM which would be part of the VNet.
  2. Create a self-hosted agent on an Azure VM which is connected same VNet
  3. Create a self-hosted agent on your local machine. Using Express route, private peering or VPN tunneling to connect to the private
    endpoint.

run the build and pipelines on the self hosted agent by setting up the
pool
to your private agent pool which is hosts the self-hosted agent.

Reference: create self-hosted agent, Connecting from an on-premises environment over VPN,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文