New-AzKeyVaultNetworkRuleSetObject
Create an object representing the network rule settings.
Note
This is the previous version of our documentation. Please consult the most recent version for up-to-date information.
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
Specifies bypass of network rule.
| Type: | PSKeyVaultNetworkRuleBypassEnum |
| Accepted values: | None, AzureServices |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies default action of network rule.
| Type: | PSKeyVaultNetworkRuleDefaultActionEnum |
| Accepted values: | Allow, Deny |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
The credentials, account, tenant, and subscription used for communication with Azure.
| Type: | IAzureContextContainer |
| Aliases: | AzContext, AzureRmContext, AzureCredential |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Specifies allowed network IP address range of network rule.
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
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 |
| Accept pipeline input: | True |
| Accept wildcard characters: | False |
Specifies allowed virtual network resource identifier of network rule.
| Type: | String[] |
| Position: | Named |
| Default value: | None |
| Accept pipeline input: | False |
| Accept wildcard characters: | False |
Inputs
None