你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Add-AzWebAppAccessRestrictionRule
将 Access Restiction 规则添加到 Azure Web 应用。
语法
Add-AzWebAppAccessRestrictionRule
[-ResourceGroupName] <String>
[-WebAppName] <String>
[-Name <String>]
[-Description <String>]
-Priority <UInt32>
[-Action <String>]
[-SlotName <String>]
[-TargetScmSite]
-IpAddress <String>
[-PassThru]
[-HttpHeader <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-AzWebAppAccessRestrictionRule
[-ResourceGroupName] <String>
[-WebAppName] <String>
[-Name <String>]
[-Description <String>]
-Priority <UInt32>
[-Action <String>]
[-SlotName <String>]
[-TargetScmSite]
[-PassThru]
-ServiceTag <String>
[-HttpHeader <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-AzWebAppAccessRestrictionRule
[-ResourceGroupName] <String>
[-WebAppName] <String>
[-Name <String>]
[-Description <String>]
-Priority <UInt32>
[-Action <String>]
[-SlotName <String>]
[-TargetScmSite]
-SubnetName <String>
-VirtualNetworkName <String>
[-IgnoreMissingServiceEndpoint]
[-PassThru]
[-HttpHeader <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Add-AzWebAppAccessRestrictionRule
[-ResourceGroupName] <String>
[-WebAppName] <String>
[-Name <String>]
[-Description <String>]
-Priority <UInt32>
[-Action <String>]
[-SlotName <String>]
[-TargetScmSite]
-SubnetId <String>
[-IgnoreMissingServiceEndpoint]
[-PassThru]
[-HttpHeader <Hashtable>]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
说明
Add-AzWebAppAccessRestrictionRule cmdlet 向 Azure Web 应用添加访问限制规则。
示例
示例 1:将 IpAddress 访问限制规则添加到 Web 应用
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "Default-Web-WestUS" -WebAppName "ContosoSite" `
-Name IpRule -Priority 200 -Action Allow -IpAddress 10.10.0.0/8
此命令将优先级为 200 和 IP 范围的访问限制规则添加到属于资源组 Default-Web-WestUS 的 Web 应用。
示例 2:将子网服务终结点访问限制规则添加到 Web 应用
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "Default-Web-WestUS" -WebAppName "ContosoSite" `
-Name SubnetRule -Priority 300 -Action Allow -SubnetName appgw-subnet -VirtualNetworkName corp-vnet
此命令将优先级为 300 的访问限制规则以及 corp-vnet 中的子网 appgw-subnet 添加到属于资源组 Default-Web-WestUS 的 Web 应用。
示例 3:将 ServiceTag 访问限制规则添加到 Web 应用
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "Default-Web-WestUS" -WebAppName "ContosoSite" `
-Name ServiceTagRule -Priority 200 -Action Allow -ServiceTag AzureFrontDoor.Backend
此命令将具有优先级为 200 的访问限制规则和表示 Azure Front Door IP 范围的服务标记添加到属于资源组 Default-Web-WestUS 的 Web 应用。
示例 4:向 Web 应用添加多地址访问限制规则
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "Default-Web-WestUS" -WebAppName "ContosoSite" `
-Name MultipleIpRule -Priority 200 -Action Allow -IpAddress "10.10.0.0/8,192.168.0.0/16"
此命令将优先级为 200 和两个 IP 范围的访问限制规则添加到属于资源组 Default-Web-WestUS 的 Web 应用。
示例 5:将 Http 标头的访问限制规则添加到 Web 应用
Add-AzWebAppAccessRestrictionRule -ResourceGroupName "Default-Web-WestUS" -WebAppName "ContosoSite" `
-Name MultipleIpRule -Priority 400 -Action Allow -ServiceTag AzureFrontDoor.Backend `
-HttpHeader @{'x-forwarded-host' = 'www.contoso.com', 'app.contoso.com'; 'x-azure-fdid' = '355deb06-47c4-4ba4-9641-c7d7a98b913e'}
此命令为 Service Tag AzureFrontDoor.Backend 添加了优先级为 400 的访问限制规则,并进一步限制对属于资源组 Default-Web-WestUS 的 Web 应用的 HTTP 标头的访问。
参数
-Action
允许或拒绝规则。
类型: | String |
接受的值: | Allow, Deny |
Position: | Named |
默认值: | Allow |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Confirm
在运行 cmdlet 之前,提示你进行确认。
类型: | SwitchParameter |
别名: | cf |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-DefaultProfile
用于与 Azure 通信的凭据、帐户、租户和订阅。
类型: | IAzureContextContainer |
别名: | AzContext, AzureRmContext, AzureCredential |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Description
访问限制说明。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-HttpHeader
Http 标头限制。 示例:-HttpHeader @{'x-azure-fdid' = '7acacb02-47ea-4cd4-b568-5e880e72582e';“x-forwarded-host” = 'www.contoso.com', 'app.contoso.com'}
类型: | Hashtable |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-IgnoreMissingServiceEndpoint
指定是否应验证子网中的服务终结点注册。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-IpAddress
IP 地址 v4 或 v6 CIDR 范围。 例如:192.168.0.0/24
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-Name
规则名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-PassThru
返回访问限制配置对象。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-Priority
访问限制优先级。 例如:500。
类型: | UInt32 |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-ResourceGroupName
资源组名称
类型: | String |
Position: | 0 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-ServiceTag
服务标记的名称
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SlotName
部署槽名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-SubnetId
子网的 ResourceId。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-SubnetName
子网的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-TargetScmSite
规则针对主站点或 Scm 站点。
类型: | SwitchParameter |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |
-VirtualNetworkName
虚拟网络的名称。
类型: | String |
Position: | Named |
默认值: | None |
必需: | True |
接受管道输入: | False |
接受通配符: | False |
-WebAppName
Web 应用的名称。
类型: | String |
Position: | 1 |
默认值: | None |
必需: | True |
接受管道输入: | True |
接受通配符: | False |
-WhatIf
显示 cmdlet 运行时会发生什么情况。 cmdlet 未运行。
类型: | SwitchParameter |
别名: | wi |
Position: | Named |
默认值: | None |
必需: | False |
接受管道输入: | False |
接受通配符: | False |