< Back

Add-AzureRmStorageAccountNetworkRule

Tue Jan 29, 2019 10:11 pm

NAME Add-AzureRmStorageAccountNetworkRule



SYNOPSIS

Add IpRules or VirtualNetworkRules to the NetworkRule property of a Storage account





SYNTAX

Add-AzureRmStorageAccountNetworkRule [-ResourceGroupName] <String> [-Name] <String> [-AsJob] [-DefaultProfile <IAzureContextContainer>]

-IPAddressOrRange <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]



Add-AzureRmStorageAccountNetworkRule [-ResourceGroupName] <String> [-Name] <String> [-AsJob] [-DefaultProfile <IAzureContextContainer>] -IPRule

<PSIpRule[]> [-Confirm] [-WhatIf] [<CommonParameters>]



Add-AzureRmStorageAccountNetworkRule [-ResourceGroupName] <String> [-Name] <String> [-AsJob] [-DefaultProfile <IAzureContextContainer>]

-VirtualNetworkResourceId <String[]> [-Confirm] [-WhatIf] [<CommonParameters>]



Add-AzureRmStorageAccountNetworkRule [-ResourceGroupName] <String> [-Name] <String> [-AsJob] [-DefaultProfile <IAzureContextContainer>]

-VirtualNetworkRule <PSVirtualNetworkRule[]> [-Confirm] [-WhatIf] [<CommonParameters>]





DESCRIPTION

The Add-AzureRmStorageAccountNetworkRule cmdlet adds IpRules or VirtualNetworkRules to the NetworkRule property of a Storage account





PARAMETERS

-AsJob [<SwitchParameter>]

Run cmdlet in the background



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-DefaultProfile <IAzureContextContainer>

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



Required? false

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IPAddressOrRange <String[]>

The Array of IpAddressOrRange, add IpRules with the input IpAddressOrRange and default Action Allow to NetworkRule Property.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-IPRule <PSIpRule[]>

The Array of IpRule objects to add to the NetworkRule Property.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Name <String>

Specifies the name of the Storage account.



Required? true

Position? 1

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-ResourceGroupName <String>

Specifies the name of the resource group contains the Storage account.



Required? true

Position? 0

Default value None

Accept pipeline input? True (ByPropertyName)

Accept wildcard characters? false



-VirtualNetworkResourceId <String[]>

The Array of VirtualNetworkResourceId, will add VirtualNetworkRule with input VirtualNetworkResourceId and default Action Allow to NetworkRule

Property.



Required? true

Position? named

Default value None

Accept pipeline input? False

Accept wildcard characters? false



-VirtualNetworkRule <PSVirtualNetworkRule[]>

The Array of VirtualNetworkRule objects to add to the NetworkRule Property.



Required? true

Position? named

Default value None

Accept pipeline input? True (ByValue)

Accept wildcard characters? false



-Confirm [<SwitchParameter>]

Prompts you for confirmation before running the cmdlet.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]

Shows what would happen if the cmdlet runs. The cmdlet is not run.



Required? false

Position? named

Default value False

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String

Microsoft.Azure.Commands.Management.Storage.Models.PSIpRule[] Microsoft.Azure.Commands.Management.Storage.Models.PSVirtualNetworkRule[]





OUTPUTS

Microsoft.Azure.Commands.Management.Storage.Models.PSVirtualNetworkRule

Microsoft.Azure.Commands.Management.Storage.Models.PSIpRule





NOTES









Example 1: Add several IpRules with IPAddressOrRange



PS C:\\>Add-AzureRMStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -AccountName "mystorageaccount" -IPAddressOrRange

"10.0.0.0/24","28.2.0.0/16"



This command add several IpRules with IPAddressOrRange.





Example 2: Add a VirtualNetworkRule with VirtualNetworkResourceID



PS C:\\>$subnet = Get-AzureRmVirtualNetwork -ResourceGroupName "myResourceGroup" -Name "myvirtualnetwork" | Get-AzureRmVirtualNetworkSubnetConfig

PS C:\\>Add-AzureRMStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -AccountName "mystorageaccount" -VirtualNetworkResourceId

$subnet[0].Id



This command add a VirtualNetworkRule with VirtualNetworkResourceID.





Example 3: Add VirtualNetworkRules with VirtualNetworkRule Objects from another account



PS C:\\> $networkrule = Get-AzureRMStorageAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -AccountName "mystorageaccount1"

PS C:\\> Add-AzureRMStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -AccountName "mystorageaccount2" -VirtualNetworkRule

$networkrule.VirtualNetworkRules



This command add VirtualNetworkRules with VirtualNetworkRule Objects from another account.





Example 4: Add several IpRule with IpRule objects, input with JSON



PS C:\\>Add-AzureRMStorageAccountNetworkRule -ResourceGroupName "myResourceGroup" -AccountName "mystorageaccount" -IPRule

(@{IPAddressOrRange="10.0.0.0/24";Action="allow"},@{IPAddressOrRange="28.2.0.0/16";Action="allow"})



This command add several IpRule with IpRule objects, input with JSON.







RELATED LINKS

Online Version: https://docs.microsoft.com/en-us/powers ... etworkrule