New-AzSqlServerFirewallRule
语法
UserSpecifiedRuleSet
New-AzSqlServerFirewallRule
[-ServerName] <String>
[-ResourceGroupName] <String>
-FirewallRuleName <String>
-StartIpAddress <String>
-EndIpAddress <String>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
AzureIpRuleSet
New-AzSqlServerFirewallRule
[-ServerName] <String>
[-ResourceGroupName] <String>
[-AllowAllAzureIPs]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
New-AzSqlServerFirewallRule cmdlet 为指定的Azure SQL 数据库服务器创建防火墙规则。
示例
示例 1:创建防火墙规则
New-AzSqlServerFirewallRule -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -FirewallRuleName "Rule01" -StartIpAddress "192.168.0.198" -EndIpAddress "192.168.0.199"
ResourceGroupName : ResourceGroup01
ServerName : Server01
StartIpAddress : 192.168.0.198
EndIpAddress : 192.168.0.199
FirewallRuleName : Rule01
此命令在名为 Server01 的服务器上创建名为 Rule01 的防火墙规则。
该规则包括指定的开始和结束 IP 地址。
示例 2:创建允许所有 Azure IP 地址访问服务器的防火墙规则
New-AzSqlServerFirewallRule -ResourceGroupName "ResourceGroup01" -ServerName "Server01" -AllowAllAzureIPs
此命令在名为 Server01 的服务器上创建防火墙规则,该规则属于名为 ResourceGroup01 的资源组。
由于使用了 AllowAllAzureIPs 参数,防火墙规则允许所有 Azure IP 地址访问服务器。
参数
-AllowAllAzureIPs
指示此防火墙规则允许所有 Azure IP 地址访问服务器。
如果打算使用 FirewallRuleName、StartIpAddress 和 EndIpAddress 参数,则不能使用此参数。
如果要允许 Azure IP 访问服务器,则应在不使用 FirewallRuleName、StartIpAddress 和 EndIpAddress 参数的单独 cmdlet 调用中使用此参数。
参数属性
参数集
AzureIpRuleSet
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-DefaultProfile
用于与 azure 通信的凭据、帐户、租户和订阅
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-EndIpAddress
指定此规则的 IP 地址范围的结束值。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
UserSpecifiedRuleSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-FirewallRuleName
指定新防火墙规则的名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
别名: | 名称 |
参数集
UserSpecifiedRuleSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-ResourceGroupName
指定为其分配服务器的资源组的名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 0 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-ServerName
指定服务器的名称。
指定服务器名称,而不是完全限定的 DNS 名称。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
(All)
Position: | 1 |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | True |
来自剩余参数的值: | False |
-StartIpAddress
指定防火墙规则的 IP 地址范围的起始值。
参数属性
类型: | String
|
默认值: | None |
支持通配符: | False |
不显示: | False |
参数集
UserSpecifiedRuleSet
Position: | Named |
必需: | True |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。
命令脚本未运行。
参数属性
参数集
(All)
Position: | Named |
必需: | False |
来自管道的值: | False |
来自管道的值(按属性名称): | False |
来自剩余参数的值: | False |
CommonParameters
此 cmdlet 支持通用参数:-Debug、-ErrorAction、-ErrorVariable、-InformationAction、-InformationVariable、-OutBuffer、-OutVariable、-PipelineVariable、-ProgressAction、-Verbose、-WarningAction 和 -WarningVariable。 有关详细信息,请参阅 about_CommonParameters。
输出