I try to update my database on SQL Azure from VSTS.
I need to apply a firewall rules during the migration and remove it after.
I'm using a VSTS Azure PowerShell Task, I've configured it and I try this command to add a rule:
New-AzureSqlDatabaseServerFirewallRule -ServerName $serverName -RuleName $firewallRule -StartIpAddress $currentPublicIp -EndIpAddress $currentPublicIp
The task fails with this error message:
##[error]No default subscription has been designated. Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.
The task is starting with this in logs:
##[command]Add-AzureRMAccount -ServicePrincipal -Tenant ******** -Credential System.Management.Automation.PSCredential -Environment AzureCloud
##[command]Select-AzureRMSubscription -SubscriptionId xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx -TenantId ********
New-AzureSqlDatabaseServerFirewallRule
is a classic cmdlet. You should useNew-AzureRmSqlServerFirewallRule -ResourceGroupName "" -ServerName "" -FirewallRuleName "Rule01" -StartIpAddress "192.168.0.198" -EndIpAddress "192.168.0.199"
– Shui shengbao