Azure devops 允许 Azure VM 的 IP 规则
Azure devops allow IP's rules of Azure VM
我在 Azure 上有一个运行 SQL 服务器的虚拟机,我想在 Azure devops 的构建管道中更新我的数据库。但是 SQL 服务器的端口只允许某些 IP,我不想向所有人公开...可以在构建中更新允许的 IP 吗?
我发现这个 link 可以帮助获取托管的 IP:https://docs.microsoft.com/pt-br/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#agent-ip-range
Microsoft 每周更新 json 管道主机 IP 但在 json 中是服务和 ips,但我不知道服务的名称我应该获得IP。我没有找到任何类似“devops”或“pipeline”的东西。
除此之外,是否可以在构建管道中自动更新允许的 ip?我发现这个 post: https://blog.simontimms.com/2020/01/10/2020-01-10-Allow-hosted-agents-through-firewall/ 但我不知道如何编辑我的管道来做到这一点。
谢谢
要在Json文件中确认Microsoft-hosted代理的IP地址,您需要检查Organizaiton的区域。
您可以导航到 Organization Settings -> Overview
并检查组织所在的区域。
然后您可以在 Json 文件中搜索 AzureCloud.<region>
以获取 Ipaddress 前缀。
对于 运行 博客的脚本,您可以在管道中添加 Azure Powershell
任务。
顺便说一句,您需要在使用此任务之前创建 Azure 服务连接。
另外你可能会遇到这个问题。
##[error]No MSFT_NetFirewallRule objects found with property 'DisplayName' equal to ' Remote Event Monitor'. Verify the value of
the property and retry.
此问题的原因是不存在同名的防火墙规则。
您需要使用 New-NetFirewallRule script 使用目标名称创建新的防火墙。
例如:
New-NetFirewallRule -DisplayName "Test" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow
然后您可以使用 Set-NetFirewallRule 脚本设置防火墙规则。
我在我的 phone 上,所以我无法对此进行测试,但是您可以使用类似命令的命令找到您在任务中所在的托管代理的 Public IP nslookup myip.opendns.com。 resolver1.opendns.com' 然后将其添加到您的 NSG,然后在完成后将其删除。
在 Azure 应用中从云端 shell 进行测试
https://imgur.com/a/lau2ZDs
我在 Azure 上有一个运行 SQL 服务器的虚拟机,我想在 Azure devops 的构建管道中更新我的数据库。但是 SQL 服务器的端口只允许某些 IP,我不想向所有人公开...可以在构建中更新允许的 IP 吗?
我发现这个 link 可以帮助获取托管的 IP:https://docs.microsoft.com/pt-br/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml#agent-ip-range
Microsoft 每周更新 json 管道主机 IP 但在 json 中是服务和 ips,但我不知道服务的名称我应该获得IP。我没有找到任何类似“devops”或“pipeline”的东西。
除此之外,是否可以在构建管道中自动更新允许的 ip?我发现这个 post: https://blog.simontimms.com/2020/01/10/2020-01-10-Allow-hosted-agents-through-firewall/ 但我不知道如何编辑我的管道来做到这一点。
谢谢
要在Json文件中确认Microsoft-hosted代理的IP地址,您需要检查Organizaiton的区域。
您可以导航到 Organization Settings -> Overview
并检查组织所在的区域。
然后您可以在 Json 文件中搜索 AzureCloud.<region>
以获取 Ipaddress 前缀。
对于 运行 博客的脚本,您可以在管道中添加 Azure Powershell
任务。
顺便说一句,您需要在使用此任务之前创建 Azure 服务连接。
另外你可能会遇到这个问题。
##[error]No MSFT_NetFirewallRule objects found with property 'DisplayName' equal to ' Remote Event Monitor'. Verify the value of the property and retry.
此问题的原因是不存在同名的防火墙规则。
您需要使用 New-NetFirewallRule script 使用目标名称创建新的防火墙。
例如:
New-NetFirewallRule -DisplayName "Test" -Direction Inbound -LocalPort 80 -Protocol TCP -Action Allow
然后您可以使用 Set-NetFirewallRule 脚本设置防火墙规则。
我在我的 phone 上,所以我无法对此进行测试,但是您可以使用类似命令的命令找到您在任务中所在的托管代理的 Public IP nslookup myip.opendns.com。 resolver1.opendns.com' 然后将其添加到您的 NSG,然后在完成后将其删除。
在 Azure 应用中从云端 shell 进行测试 https://imgur.com/a/lau2ZDs