Search code examples
azure-powershellazure-sql-server

Azure SQL Server firewall configuration using PowerShell not working


When executing New-AzSqlServerFirewallRule -ResourceGroupName $ResourceGroupName -ServerName $SqlServerName -AllowAllAzureIPs

I get this error: New-AzSqlServerFirewallRule : Could not load type 'Microsoft.Azure.CertificateCloudCredentials' from assembly 'Microsoft.Azure.Common, Version=2.0.0.0 ...

The user I'm using has Owner rights on the Subscription. I can successfully execute e.g. New-AzSqlServer. However, Get-AzSqlServerFirewallRule is also not working. Installed the latest Az.Sql 2.12.0.

When configuring via the Portal I get below error, but the configuration is accepted never the less: Failed to overwrite firewall rules for server: weu-te-sdb-patrntest-01 and refresh the blade. ErrorCode: undefined ErrorMessage: Cannot read property 'toString' of undefined


Solution

  • Upgrading to the following PowerShell modules did the trick: Az 5.1.0 Az.Accounts 2.2.2 Az.Sql 2.12.0

    Couldn't determine why I had that error in the Portal. However the deployment of a new Azure SQL instance and using above module versions worked.