Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

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

-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

-DefaultAction

Default Action for Network Rule Set

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-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

-InputObject

Identity parameter. To construct, see NOTES section for INPUTOBJECT properties and create a hash table.

Parameter properties

Type:IEventHubIdentity
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-IPRule

List of IpRules

Parameter properties

Type:

INwRuleSetIPRules[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-NamespaceName

The name of EventHub namespace

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-NoWait

Run the command asynchronously

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-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

-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

-SubscriptionId

The ID of the target subscription.

Parameter properties

Type:String
Default value:(Get-AzContext).Subscription.Id
Supports wildcards:False
DontShow:False

Parameter sets

-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

-VirtualNetworkRule

List of VirtualNetwork Rules

Parameter properties

Type:

INwRuleSetVirtualNetworkRules[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

-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

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.

Inputs

IEventHubIdentity

Outputs

INetworkRuleSet


Feedback

Was this page helpful?