Editar

Compartilhar via


New-AzKeyVaultNetworkRuleSetObject

Create an object representing the network rule settings.

Syntax

New-AzKeyVaultNetworkRuleSetObject
   [-DefaultAction <PSKeyVaultNetworkRuleDefaultActionEnum>]
   [-Bypass <PSKeyVaultNetworkRuleBypassEnum>]
   [-IpAddressRange <String[]>]
   [-VirtualNetworkResourceId <String[]>]
   [-DefaultProfile <IAzureContextContainer>]
   [-SubscriptionId <String>]
   [<CommonParameters>]

Description

Create an object representing the network rule settings that can be used when creating a vault.

Examples

Example 1

$frontendSubnet = New-AzVirtualNetworkSubnetConfig -Name frontendSubnet -AddressPrefix "110.0.1.0/24" -ServiceEndpoint Microsoft.KeyVault
$virtualNetwork = New-AzVirtualNetwork -Name myVNet -ResourceGroupName myRG -Location westus -AddressPrefix "110.0.0.0/16" -Subnet $frontendSubnet
$myNetworkResId = (Get-AzVirtualNetwork -Name myVNet -ResourceGroupName myRG).Subnets[0].Id
$ruleSet = New-AzKeyVaultNetworkRuleSetObject -DefaultAction Allow -Bypass AzureServices -IpAddressRange "110.0.1.0/24" -VirtualNetworkResourceId $myNetworkResId
New-AzKeyVault -ResourceGroupName "myRg" -VaultName "myVault" -NetworkRuleSet $ruleSet

Creating a new vault and specifies network rules to allow access to the specified IP address from the virtual network identified by $myNetworkResId.

Parameters

-Bypass

Specifies bypass of network rule.

Type:PSKeyVaultNetworkRuleBypassEnum
Accepted values:None, AzureServices
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultAction

Specifies default action of network rule.

Type:PSKeyVaultNetworkRuleDefaultActionEnum
Accepted values:Allow, Deny
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-DefaultProfile

The credentials, account, tenant, and subscription used for communication with Azure.

Type:IAzureContextContainer
Aliases:AzContext, AzureRmContext, AzureCredential
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-IpAddressRange

Specifies allowed network IP address range of network rule.

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

-SubscriptionId

The ID of the subscription. By default, cmdlets are executed in the subscription that is set in the current context. If the user specifies another subscription, the current cmdlet is executed in the subscription specified by the user. Overriding subscriptions only take effect during the lifecycle of the current cmdlet. It does not change the subscription in the context, and does not affect subsequent cmdlets.

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

-VirtualNetworkResourceId

Specifies allowed virtual network resource identifier of network rule.

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

Inputs

None

Outputs

PSKeyVaultNetworkRuleSet