New-AzureSqlDatabaseServerFirewallRule

Creates a firewall rule in Azure SQL Database Server.

Syntax

New-AzureSqlDatabaseServerFirewallRule
   [-AllowAllAzureServices]
   [-Force]
   [-Profile <AzureSMProfile>]
   [-RuleName <String>]
   -ServerName <String>
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]
New-AzureSqlDatabaseServerFirewallRule
   -EndIpAddress <String>
   [-Force]
   [-Profile <AzureSMProfile>]
   -RuleName <String>
   -ServerName <String>
   -StartIpAddress <String>
   [-Confirm]
   [-WhatIf]
   [<CommonParameters>]

Description

The New-AzureSqlDatabaseServerFirewallRule cmdlet creates a firewall rule in the specified instance of Azure SQL Database Server in the current subscription.

Use the StartIpAddress and EndIpAddress parameters to specify a range of IP addresses that this rule allows to connect to the Azure SQL Database server.

Specify the AllowAllAzureServices parameter to create a rule that allows Azure connections to the server. The rule has starting and ending IP address values of 0.0.0.0. If you do not specify a firewall rule name, this cmdlet assigns the default name AllowAllAzureServices.

Examples

Example 1: Create a firewall rule

PS C:\>New-AzureSqlDatabaseServerFirewallRule -ServerName "lpqd0zbr8y" -RuleName "FirewallRule24" -StartIpAddress 10.1.1.1 -EndIpAddress 10.1.1.2

This command creates a firewall rule FirewallRule24 on the Azure SQL Database server named lpqd0zbr8y. The command specifies an IP address range.

Example 2: Create a rule that allows all Azure services

PS C:\>New-AzureSqlDatabaseServerFirewallRule -ServerName "lpqd0zbr8y" -AllowAllAzureServices -RuleName "AzureConnections"

This command creates a firewall rule named AzureConnections on the server named lpqd0zbr8y that allows Azure connections.

Example 3: Create a rule that allows all Azure services that uses the default name Create a rule that allows all Azure services that uses the default name

PS C:\>New-AzureSqlDatabaseServerFirewallRule -ServerName "lpqd0zbr8y" -AllowAllAzureServices

This command creates a firewall rule on the specified server named lpqd0zbr8y that allows Azure connections. The command assigns the default rule name AllowAllAzureServices.

Required Parameters

-AllowAllAzureServices

Indicates that this firewall rule enables all Azure IP addresses to access the server.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EndIpAddress

Specifies the end value of the IP address range for this rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-RuleName

Specifies the name of the new firewall rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ServerName

Specifies the name of a server. This cmdlet creates a firewall rule on the server that this cmdlet specifies. Specify the server name, not the fully qualified DNS name.

Type:String
Position:Named
Default value:None
Accept pipeline input:True (ByPropertyName)
Accept wildcard characters:False
-StartIpAddress

Specifies the start value of the IP address range for the firewall rule.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False
-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Profile

Specifies the Azure profile from which this cmdlet reads. If you do not specify a profile, this cmdlet reads from the local default profile.

Type:AzureSMProfile
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

Microsoft.WindowsAzure.Commands.SqlDatabase.Model.SqlDatabaseServerFirewallRuleContext