Set-AzEventHubNetworkRuleSet
Sets an EventHub Namespace Network Rule Set
Syntax
SetExpanded (Default)
Set-AzEventHubNetworkRuleSet
-NamespaceName <String>
-ResourceGroupName <String>
[-SubscriptionId <String>]
[-PublicNetworkAccess <String>]
[-TrustedServiceAccessEnabled]
[-DefaultAction <String>]
[-IPRule <INwRuleSetIPRules[]>]
[-VirtualNetworkRule <INwRuleSetVirtualNetworkRules[]>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
SetViaIdentityExpanded
Set-AzEventHubNetworkRuleSet
-InputObject <IEventHubIdentity>
[-PublicNetworkAccess <String>]
[-TrustedServiceAccessEnabled]
[-DefaultAction <String>]
[-IPRule <INwRuleSetIPRules[]>]
[-VirtualNetworkRule <INwRuleSetVirtualNetworkRules[]>]
[-DefaultProfile <PSObject>]
[-AsJob]
[-NoWait]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
Sets an EventHub Namespace Network Rule Set
Examples
Example 1: Add IP Rules and Virtual Network Rules to a Network Rule Set
$ipRule1 = New-AzEventHubIPRuleConfig -IPMask 2.2.2.2 -Action Allow
$ipRule2 = New-AzEventHubIPRuleConfig -IPMask 3.3.3.3 -Action Allow
$virtualNetworkRule1 = New-AzEventHubVirtualNetworkRuleConfig -SubnetId '/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/default'
$networkRuleSet = Get-AzEventHubNetworkRuleSet -ResourceGroupName myResourceGroup -NamespaceName myNamespace
$networkRuleSet.IPRule += $ipRule1
$networkRuleSet.IPRule += $ipRule2
$networkRuleSet.VirtualNetworkRule += $virtualNetworkRule1
Set-AzEventHubNetworkRuleSet -ResourceGroupName myResourceGroup -NamespaceName myNamespace -IPRule $ipRule1,$ipRule2 -VirtualNetworkRule $virtualNetworkRule1,$virtualNetworkRule2,$virtualNetworkRule3
DefaultAction : Deny
IPRule : {{
"ipMask": "1.1.1.1",
"action": "Allow"
}, {
"ipMask": "2.2.2.2",
"action": "Allow"
}, {
"ipMask": "3.3.3.3",
"action": "Allow"
}}
Id : /subscriptions/subscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace/networkRuleSets/
default
Location : Australia East
Name : default
PublicNetworkAccess : Enabled
ResourceGroupName : Default-EventHub-6229
TrustedServiceAccessEnabled :
Type : Microsoft.EventHub/Namespaces/NetworkRuleSets
VirtualNetworkRule : {{
"subnet": {
"id": "/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/default"
},
"ignoreMissingVnetServiceEndpoint": false
},{
"subnet": {
"id": "/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"
},
"ignoreMissingVnetServiceEndpoint": false
}}
Appends virtual network rules and IPRules to the existing rules.
Example 2: Enable Trusted Service Access on a namespace
Set-AzEventHubNetworkRuleSet -ResourceGroupName myResourceGroup -NamespaceName myNamespace -TrustedServiceAccessEnabled
DefaultAction : Deny
IPRule : {{
"ipMask": "1.1.1.1",
"action": "Allow"
}, {
"ipMask": "2.2.2.2",
"action": "Allow"
}, {
"ipMask": "3.3.3.3",
"action": "Allow"
}}
Id : /subscriptions/subscriptionId/resourceGroups/myResourceGroup/providers/Microsoft.EventHub/namespaces/myNamespace/networkRuleSets/
default
Location : Australia East
Name : default
PublicNetworkAccess : Enabled
ResourceGroupName : myResourceGroup
TrustedServiceAccessEnabled : True
Type : Microsoft.EventHub/Namespaces/NetworkRuleSets
VirtualNetworkRule : {{
"subnet": {
"id": "/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/default"
},
"ignoreMissingVnetServiceEndpoint": false
},{
"subnet": {
"id": "/subscriptions/subscriptionId/resourcegroups/myResourceGroup/providers/Microsoft.Network/virtualNetworks/myVirtualNetwork/subnets/mySubnet"
},
"ignoreMissingVnetServiceEndpoint": false
}}
Enabled Trusted Service Access on the eventhub namespace myNamespace
.
Parameters
-AsJob
Run the command as a job
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: cf
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultAction
Default Action for Network Rule Set
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: PSObject
Default value: None
Supports wildcards: False
DontShow: False
Aliases: AzureRMContext, AzureCredential
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
Identity parameter.
To construct, see NOTES section for INPUTOBJECT properties and create a hash table.
SetViaIdentityExpanded
Position: Named
Mandatory: True
Value from pipeline: True
Value from pipeline by property name: False
Value from remaining arguments: False
-IPRule
List of IpRules
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-NamespaceName
The name of EventHub namespace
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SetExpanded
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-NoWait
Run the command asynchronously
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-PublicNetworkAccess
This determines if traffic is allowed over public network.
By default it is enabled.
If value is SecuredByPerimeter then Inbound and Outbound communication is controlled by the network security perimeter and profile's access rules.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-ResourceGroupName
The name of the resource group.
The name is case insensitive.
Parameter properties
Type: String
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
SetExpanded
Position: Named
Mandatory: True
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-SubscriptionId
The ID of the target subscription.
Parameter properties
Type: String
Default value: (Get-AzContext).Subscription.Id
Supports wildcards: False
DontShow: False
Parameter sets
SetExpanded
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-TrustedServiceAccessEnabled
Value that indicates whether Trusted Service Access is Enabled or not.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-VirtualNetworkRule
List of VirtualNetwork Rules
Parameter properties
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
-WhatIf
Shows what would happen if the cmdlet runs.
The cmdlet is not run.
Parameter properties
Type: SwitchParameter
Default value: None
Supports wildcards: False
DontShow: False
Aliases: wi
Parameter sets
(All)
Position: Named
Mandatory: False
Value from pipeline: False
Value from pipeline by property name: False
Value from remaining arguments: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable,
-InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable,
-ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see
about_CommonParameters .
Outputs