Update-AzCosmosDBAccount

Update a CosmosDB account attributes.

Syntax

Update-AzCosmosDBAccount
      [-EnableAutomaticFailover <Boolean>]
      [-EnableMultipleWriteLocations <Boolean>]
      [-EnableVirtualNetwork <Boolean>]
      [-DisableKeyBasedMetadataWriteAccess <Boolean>]
      -ResourceGroupName <String>
      -Name <String>
      [-DefaultConsistencyLevel <String>]
      [-IpRule <String[]>]
      [-MaxStalenessIntervalInSeconds <Int32>]
      [-MaxStalenessPrefix <Int32>]
      [-Tag <Hashtable>]
      [-VirtualNetworkRule <String[]>]
      [-VirtualNetworkRuleObject <PSVirtualNetworkRule[]>]
      [-PublicNetworkAccess <String>]
      [-KeyVaultKeyUri <String>]
      [-EnableAnalyticalStorage <Boolean>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBAccount
      -ResourceId <String>
      [-EnableAutomaticFailover <Boolean>]
      [-EnableMultipleWriteLocations <Boolean>]
      [-EnableVirtualNetwork <Boolean>]
      [-DisableKeyBasedMetadataWriteAccess <Boolean>]
      [-DefaultConsistencyLevel <String>]
      [-IpRule <String[]>]
      [-MaxStalenessIntervalInSeconds <Int32>]
      [-MaxStalenessPrefix <Int32>]
      [-Tag <Hashtable>]
      [-VirtualNetworkRule <String[]>]
      [-VirtualNetworkRuleObject <PSVirtualNetworkRule[]>]
      [-PublicNetworkAccess <String>]
      [-KeyVaultKeyUri <String>]
      [-EnableAnalyticalStorage <Boolean>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Update-AzCosmosDBAccount
      -InputObject <PSDatabaseAccountGetResults>
      [-EnableAutomaticFailover <Boolean>]
      [-EnableMultipleWriteLocations <Boolean>]
      [-EnableVirtualNetwork <Boolean>]
      [-DisableKeyBasedMetadataWriteAccess <Boolean>]
      [-DefaultConsistencyLevel <String>]
      [-IpRule <String[]>]
      [-MaxStalenessIntervalInSeconds <Int32>]
      [-MaxStalenessPrefix <Int32>]
      [-Tag <Hashtable>]
      [-VirtualNetworkRule <String[]>]
      [-VirtualNetworkRuleObject <PSVirtualNetworkRule[]>]
      [-PublicNetworkAccess <String>]
      [-KeyVaultKeyUri <String>]
      [-EnableAnalyticalStorage <Boolean>]
      [-AsJob]
      [-DefaultProfile <IAzureContextContainer>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

Update the properties of a CosmosDB account. Cannot update Account Regions simulataneously with other properties.

Examples

Example 1

PS C:\> Update-AzCosmosDBAccount -ResourceGroupName resourceGroupName -Name accountName -DefaultConsistencyLevel "Strong" -EnableAutomaticFailover 1 -EnableMultipleWriteLocations 1 -EnableVirtualNetwork 1

Kind                          : GlobalDocumentDB
ProvisioningState             : Initializing
DocumentEndpoint              :
DatabaseAccountOfferType      : Standard
IpRangeFilter                 :
IsVirtualNetworkFilterEnabled : True
EnableAutomaticFailover       : True
ConsistencyPolicy             : Microsoft.Azure.Management.CosmosDB.Fluent.Models.ConsistencyPolicy
Capabilities                  : {}
WriteLocations                : {accountName-eastus}
ReadLocations                 : {accountName-eastus}
FailoverPolicies              : {accountName-eastus}
VirtualNetworkRules           : {}
EnableMultipleWriteLocations  : True
Location                      : East US
Tags                          : {}
Id                            : /subscriptions/{subscriptionid}/resourceGroups/resourceGroupName/providers/Microsoft.DocumentDB/databaseAccounts/accountName
Name                          : accountName
Type                          : Microsoft.DocumentDB/databaseAccounts

Updated DefaultConsistencyLevel to "Strong", Enabled AutomaticFailover, Enabled MultipleWriteLocations and Enabled VirtualNetwork for CosmosDB Account with name accountName.

Parameters

-AsJob

Run cmdlet in the background

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-DefaultConsistencyLevel

Default consistency level of the Cosmos DB database account. Accepted values: BoundedStaleness, ConsistentPrefix, Eventual, Session, Strong

Type:String
Position:Named
Default value:None
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
Accept pipeline input:False
Accept wildcard characters:False
-DisableKeyBasedMetadataWriteAccess

Disable write operations on metadata resources (databases, containers, throughput) via account keys

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnableAnalyticalStorage

Bool to indicate if AnalyticalStorage is enabled on the account.

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnableAutomaticFailover

Enables automatic failover of the write region in the rare event that the region is unavailable due to an outage. Automatic failover will result in a new write region for the account and is chosen based on the failover priorities configured for the account. Accepted values: false, true

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnableMultipleWriteLocations

Enable Multiple Write Locations. Accepted values: false, true

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-EnableVirtualNetwork

Enables virtual network on the Cosmos DB database account. Accepted values: false, true

Type:Boolean
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-InputObject

CosmosDB Account object

Type:PSDatabaseAccountGetResults
Position:Named
Default value:None
Accept pipeline input:True
Accept wildcard characters:False
-IpRule

Firewall support. Specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account.

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

URI of the KeyVault

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MaxStalenessIntervalInSeconds

When used with Bounded Staleness consistency, this value represents the time amount of staleness (in timespan) tolerated. Accepted range for this value is 5-86400.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-MaxStalenessPrefix

When used with Bounded Staleness consistency, this value represents the number of stale requests tolerated. Accepted range for this value is 1 - 2,147,483,647.

Type:Int32
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Name

Name of the Cosmos DB database account.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-PublicNetworkAccess

Whether or not public endpoint access is allowed for this server. Possible values include: 'Enabled', 'Disabled'

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceGroupName

Name of resource group.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ResourceId

ResourceId of the resource.

Type:String
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-Tag

Hashtable of tags as key-value pairs. Use empty string to clear existing tag.

Type:Hashtable
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-VirtualNetworkRule

Array of string values of ACL's for virtual network.

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

Array of PSVirtualNetworkRuleObjects for virtual network.

Type:PSVirtualNetworkRule[]
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-WhatIf

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

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False

Inputs

Microsoft.Azure.Commands.CosmosDB.Models.PSCorsRule[]

Outputs

Microsoft.Azure.Commands.CosmosDB.Models.PSDatabaseAccount