Azure DevOps/Pipeline IP 随机变化,因此由于防火墙规则,我无法使用 Azure SQL 数据库。
这种情况下的解决办法是什么?
在连接数据库之前,您可以根据代理的当前 IP 创建防火墙规则,如下所示:
- task: AzureCLI@2
inputs:
azureSubscription: [name of service connection]
scriptType: pscore
scriptLocation: inlineScript
inlineScript: |
# Set firewall on server open for the agent
$agentIp = (New-Object net.webclient).downloadstring("http://checkip.dyndns.com") -replace "[^\d\.]"
az sql server firewall-rule create -g $(rg) -s $(server) -n test --start-ip-address $agentIp --end-ip-address $agentIp
以类似的方式,您可以在管道末端将其删除。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)