Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Azure DevOps/管道IP正在随机更改,因此由于防火墙规则,我无法使用Azure SQL数据库_Azure_Azure Devops_Azure Sql Database_Azure Pipelines_Azure Pipelines Release Pipeline - Fatal编程技术网

Azure DevOps/管道IP正在随机更改,因此由于防火墙规则,我无法使用Azure SQL数据库

Azure DevOps/管道IP正在随机更改,因此由于防火墙规则,我无法使用Azure SQL数据库,azure,azure-devops,azure-sql-database,azure-pipelines,azure-pipelines-release-pipeline,Azure,Azure Devops,Azure Sql Database,Azure Pipelines,Azure Pipelines Release Pipeline,Azure DevOps/管道IP正在随机更改,因此由于防火墙规则,我无法使用Azure SQL数据库 这种情况下的解决方案是什么?我在Azure SQL数据库防火墙中添加了Azure IP范围,然后它就可以工作了。 例如: Start IP 13.107.6.0 and End IP 13.107.6.255 及 我不确定这是一个永久的解决办法 Microsoft文档参考我在Azure SQL数据库防火墙中添加了Azure IP范围,然后它就可以工作了。 例如: Start IP 13.10

Azure DevOps/管道IP正在随机更改,因此由于防火墙规则,我无法使用Azure SQL数据库


这种情况下的解决方案是什么?

我在Azure SQL数据库防火墙中添加了Azure IP范围,然后它就可以工作了。 例如:

Start IP 13.107.6.0 and End IP 13.107.6.255

我不确定这是一个永久的解决办法


Microsoft文档参考

我在Azure SQL数据库防火墙中添加了Azure IP范围,然后它就可以工作了。 例如:

Start IP 13.107.6.0 and End IP 13.107.6.255

我不确定这是一个永久的解决办法


Microsoft Doc Reference

在连接数据库之前,您可以基于代理的当前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

以类似的方式,您可以在管道末端删除它。

在连接数据库之前,您可以基于代理的当前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

通过类似的方式,您可以在管道末端删除它。

您知道使用模板而不是命令的解决方案吗?您正在显示正确的方式,但我需要使用模板进行相同的操作。这是您的意思吗?我指的是我们从任务列表中选择的模板。您是指经典管道吗?我的答案适用于yaml管道。@Nooralsafaet您可以将Azure SQL数据库部署任务的
IpDetectionMethod(使用指定防火墙规则)
字段设置为
AutoDetect
,该任务将自动将代理ip添加到防火墙规则。您知道使用模板而不是命令的解决方案吗?您正在显示正确的方式,但我需要使用模板进行相同的操作。这是您的意思吗?我指的是我们从任务列表中选择的模板。您是指经典管道吗?我的答案适用于yaml管道。@Nooralsafaet您可以将Azure SQL数据库部署任务的
IpDetectionMethod(使用指定防火墙规则)
字段设置为
AutoDetect
,该任务将自动将代理ip添加到防火墙规则。由于您的上述答案有效,在得到更好的解决方案之前,您可以接受它作为答案。因为您的上述答案有效,所以您可以在得到更好的解决方案之前接受它作为答案。