Noo*_*aet 2 azure azure-sql-database azure-devops azure-pipelines azure-pipelines-release-pipeline
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
Run Code Online (Sandbox Code Playgroud)
以类似的方式,您可以在管道末端将其删除。
| 归档时间: |
|
| 查看次数: |
2789 次 |
| 最近记录: |