##[error]A parameter cannot be found that matches parameter name 'FirewallRuleName'.

Kirti Bansal (US) 51 Reputation points
2022-04-19T08:52:01.347+00:00

Hi Team,

Have followed the steps mentioned in below documentation for Azure Sql database deployment using azure devops pipeline.

https://learn.microsoft.com/en-us/azure/devops/pipelines/targets/azure-sqldb?view=azure-devops&tabs=yaml

I am not able to run the "CLASSIC" SetAzureFirewallRule.ps1 (to create and update firewall rules), it is giving error as "##[error]A parameter cannot be found that matches parameter name 'FirewallRuleName'"

Any suggestions on this??

ARM one is working fine, until or unless it doesnot have the update step for firewall?.
Have tried with defining parameter inside the functions and viceversa but it is giving the same error.

Azure SQL Database
0 comments No comments
{count} vote

Accepted answer
  1. Alberto Morillo 32,886 Reputation points MVP
    2022-04-19T10:43:27.937+00:00

    Please change "-FirewallRuleName" by "-RuleName" as described here.


1 additional answer

Sort by: Most helpful
  1. Kirti Bansal (US) 51 Reputation points
    2022-04-21T06:13:39.023+00:00

    Powershell Script-->

    [CmdletBinding(DefaultParameterSetName = 'None')]
    param
    (
    [String] [Parameter(Mandatory = $true)] $ServerName,
    [String] $AzureFirewallName = "AzureWebAppFirewall"
    )

    $ErrorActionPreference = 'Stop'
    az login --service-principal -u <app-id> -p <appsecret> --tenant <tenant-id>
    function New-AzureSQLServerFirewallRule {
    $agentIP = (New-Object net.webclient).downloadstring("https://api.ipify.org")
    New-AzureSqlDatabaseServerFirewallRule -StartIPAddress $agentIp -EndIPAddress $agentIp -RuleName $AzureFirewallName -ServerName $ServerName
    }
    function Update-AzureSQLServerFirewallRule{
    $agentIP= (New-Object net.webclient).downloadstring("https://api.ipify.org")
    Set-AzureSqlDatabaseServerFirewallRule -StartIPAddress $agentIp -EndIPAddress $agentIp -RuleName $AzureFirewallName -ServerName $ServerName
    }
    If ((Get-AzureSqlDatabaseServerFirewallRule -ServerName $ServerName -RuleName $AzureFirewallName -ErrorAction SilentlyContinue) -eq $null)
    {
    New-AzureSQLServerFirewallRule
    }
    else
    {
    Update-AzureSQLServerFirewallRule
    }

    Note: have removed the resourcegroupname as it is giving the same error as giving for FirewallRuleName

    0 comments No comments