Add-AzCognitiveServicesAccountNetworkRule
Add IpRules or VirtualNetworkRules to the NetworkRule property of a Cognitive Services account
Syntax
NetWorkRuleString (Default)
Add-AzCognitiveServicesAccountNetworkRule
[-ResourceGroupName] <String>
[-Name] <String>
-VirtualNetworkResourceId <String[]>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
IpRuleObject
Add-AzCognitiveServicesAccountNetworkRule
[-ResourceGroupName] <String>
[-Name] <String>
-IpRule <PSIpRule[]>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
NetworkRuleObject
Add-AzCognitiveServicesAccountNetworkRule
[-ResourceGroupName] <String>
[-Name] <String>
-VirtualNetworkRule <PSVirtualNetworkRule[]>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
IpRuleString
Add-AzCognitiveServicesAccountNetworkRule
[-ResourceGroupName] <String>
[-Name] <String>
-IpAddressOrRange <String[]>
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
Description
The Add-AzCognitiveServicesAccountNetworkRule cmdlet adds IpRules or VirtualNetworkRules to the NetworkRule property of a Cognitive Services account
Examples
Example 1: Add several IpRules with IpAddressOrRange
Add-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -IpAddressOrRange "200.0.0.0/24","28.2.0.0/16"
This command add several IpRules with IpAddressOrRange.
Example 2: Add a VirtualNetworkRule with VirtualNetworkResourceID
$subnet = Get-AzVirtualNetwork -ResourceGroupName "myResourceGroup" -Name "myvirtualnetwork" | Get-AzVirtualNetworkSubnetConfig
Add-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -VirtualNetworkResourceId $subnet[0].Id
This command add a VirtualNetworkRule with VirtualNetworkResourceID.
Example 3: Add VirtualNetworkRules with VirtualNetworkRule Objects from another account
$networkrule = Get-AzCognitiveServicesAccountNetworkRuleSet -ResourceGroupName "myResourceGroup" -Name "myaccount1"
Add-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount2" -VirtualNetworkRule $networkrule.VirtualNetworkRules
This command add VirtualNetworkRules with VirtualNetworkRule Objects from another account.
Example 4: Add several IpRule with IpRule objects, input with JSON
Add-AzCognitiveServicesAccountNetworkRule -ResourceGroupName "myResourceGroup" -Name "myaccount" -IpRule (@{IpAddressOrRange="200.0.0.0/24"},@{IpAddressOrRange="28.2.0.0/16"})
This command add several IpRule with IpRule objects, input with JSON.
Parameters
-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 |
-DefaultProfile
The credentials, account, tenant, and subscription used for communication with Azure.
Parameter properties
Type: | IAzureContextContainer |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | AzContext, 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 |
-IpAddressOrRange
Cognitive Services Account NetworkRule IpRules IpAddressOrRange in string.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
IpRuleString
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-IpRule
Cognitive Services Account NetworkRule IpRules.
Parameter properties
Type: | PSIpRule[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
IpRuleObject
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-Name
Cognitive Services Account Name.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | CognitiveServicesAccountName, AccountName |
Parameter sets
(All)
Position: | 1 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-ResourceGroupName
Resource Group Name.
Parameter properties
Type: | String |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
(All)
Position: | 0 |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | True |
Value from remaining arguments: | False |
-VirtualNetworkResourceId
Cognitive Services Account NetworkRule VirtualNetworkRules VirtualNetworkResourceId in string.
Parameter properties
Type: | String[] |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Aliases: | SubnetId, VirtualNetworkId |
Parameter sets
NetWorkRuleString
Position: | Named |
Mandatory: | True |
Value from pipeline: | False |
Value from pipeline by property name: | False |
Value from remaining arguments: | False |
-VirtualNetworkRule
Cognitive Services Account NetworkRule VirtualNetworkRules.
Parameter properties
Type: | |
Default value: | None |
Supports wildcards: | False |
DontShow: | False |
Parameter sets
NetworkRuleObject
Position: | Named |
Mandatory: | True |
Value from pipeline: | True |
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.