Reputation: 5989
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 ********
Upvotes: 0
Views: 189
Reputation: 72151
You should use ARM cmdlet for the SQL DB, not ASM one. Notice the RM
in cmdlets.
New-AzureRmSqlServerFirewallRule
Set-AzureRmSqlServerFirewallRule
Upvotes: 2