-
Notifications
You must be signed in to change notification settings - Fork 46
New CosmosDbAccount
Create a new Cosmos DB account in Azure.
New-CosmosDbAccount [-Name] <String> [-ResourceGroupName] <String> [-Location] <String>
[[-LocationRead] <String[]>] [[-DefaultConsistencyLevel] <String>] [[-MaxIntervalInSeconds] <Int32>]
[[-MaxStalenessPrefix] <Int32>] [[-IpRangeFilter] <String[]>] [[-Capability] <String[]>] [[-AllowedOrgin] <String[]>]
[-AsJob] [-WhatIf] [-Confirm]
[<CommonParameters>]
Use this function to create a new Cosmos DB account resource in Azure.
You must have the Az.Resources PowerShell module installed and must also be authenticated to Azure. The Resource Group that the Cosmos DB is created in must also exist.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS'
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS' -LocationRead 'EastUS'
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region. A second Read Location will be created in 'EastUS'.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS' -IpRangeFilter @('103.29.31.78/32','103.29.31.79/32')
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region. The Cosmos DB will only be accessible from the IP addresses '103.29.31.78/32' and '103.29.31.79/32'.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS' -DefaultConsistencyLevel 'Strong'
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region. The Cosmos DB will be configured to use a default consistency level of 'Strong'.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS' -AllowedOrigin @('https://www.contoso.com','https://www.fabrikam.com')
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region. The Cosmos DB will have the CORS allowed origins set to 'https://www.contoso.com' and 'https://www.fabrikam.com'.
PS C:\> New-CosmosDbAccount -Name 'MyCosmosDB' -ResourceGroup 'MyData' -Location 'WestUS' -Capability @('EnableCassandra', 'EnableServerless')
Create a new Cosmos DB account called 'MyCosmosDB' in an existing Resource Group caled 'MyData'. The account will be created in the 'WestUS' Azure region. The Cosmos DB will be provisioned in the Serverless capacity mode with the Cassandra API.
Set Cross-Origin Resource Sharing (CORS) allowed orgin URLs on the new account. Defaults to '*'.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Create the resource in the background. The function will return immediately with a Job object that can be used to query the state of the job.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The capabilities of the database account. Only one API type should be used. For more information see https://docs.microsoft.com/en-us/azure/templates/microsoft.documentdb/databaseaccounts?tabs=json#capability.
If one of the API type's is not specified, the Core (SQL) API type will be used.
Type: String[]
Parameter Sets: (All)
Aliases:
Accepted values: EnableCassandra, EnableTable, EnableGremlin, EnableServerless
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The default consistency level of the Azure Cosmos DB account. For more information see https://docs.microsoft.com/en-us/azure/cosmos-db/consistency-levels.
If not specified th value 'Session' will be used.
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: Eventual, Strong, Session, BoundedStaleness
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
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[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The location name of the write region of the database account. This is also the region the Cosmos DB account will be created in.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The location name(s) of the read region of the database account. More than one can be specified. The order of the locations in the array affect the failover priority.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
When used with Bounded Staleness consistency, this value represents the time amount of staleness (in seconds) tolerated. Accepted range for this value is 1 - 100. This value should only be set when the DefaultConsistencyLevel is BoundedStaleness.
If not specified th value 5 will be used.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
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. This value should only be set when the DefaultConsistencyLevel is BoundedStaleness.
If not specified th value 100 will be used.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of the Cosmos DB Account to create.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The name of the existing Azure resource group to create the account in.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
- ConvertTo-CosmosDbTokenDateString
- Get-CosmosDbAccount
- Get-CosmosDbAccountConnectionString
- Get-CosmosDbAccountMasterKey
- Get-CosmosDbAttachment
- Get-CosmosDbAttachmentResourcePath
- Get-CosmosDbAuthorizationHeaderFromContext
- Get-CosmosDbCollection
- Get-CosmosDbCollectionResourcePath
- Get-CosmosDbDatabase
- Get-CosmosDbDatabaseResourcePath
- Get-CosmosDbDocument
- Get-CosmosDbDocumentResourcePath
- Get-CosmosDbEntraIdToken
- Get-CosmosDbOffer
- Get-CosmosDbOfferResourcePath
- Get-CosmosDbPermission
- Get-CosmosDbPermissionResourcePath
- Get-CosmosDbStoredProcedure
- Get-CosmosDbStoredProcedureResourcePath
- Get-CosmosDbTrigger
- Get-CosmosDbTriggerResourcePath
- Get-CosmosDbUri
- Get-CosmosDbUser
- Get-CosmosDbUserDefinedFunction
- Get-CosmosDbUserDefinedFunctionResourcePath
- Get-CosmosDbUserResourcePath
- Invoke-CosmosDbRequest
- Invoke-CosmosDbStoredProcedure
- New-CosmosDbAccount
- New-CosmosDbAccountMasterKey
- New-CosmosDbAttachment
- New-CosmosDbBackoffPolicy
- New-CosmosDbContext
- New-CosmosDbCollection
- New-CosmosDbCollectionExcludedPath
- New-CosmosDbCollectionIncludedPath
- New-CosmosDbCollectionIncludedPathIndex
- New-CosmosDbCollectionIndexingPolicy
- New-CosmosDbCollectionUniqueKey
- New-CosmosDbCollectionUniqueKeyPolicy
- New-CosmosDbDatabase
- New-CosmosDbDocument
- New-CosmosDbInvalidArgumentException
- New-CosmosDbInvalidOperationException
- New-CosmosDbPermission
- New-CosmosDbStoredProcedure
- New-CosmosDbTrigger
- New-CosmosDbUser
- New-CosmosDbUserDefinedFunction
- Remove-CosmosDbAccount
- Remove-CosmosDbAttachment
- Remove-CosmosDbCollection
- Remove-CosmosDbDatabase
- Remove-CosmosDbDocument
- Remove-CosmosDbPermission
- Remove-CosmosDbStoredProcedure
- Remove-CosmosDbTrigger
- Remove-CosmosDbUser
- Remove-CosmosDbUserDefinedFunction
- Set-CosmosDbAccount
- Set-CosmosDbAttachment
- Set-CosmosDbAttachmentType
- Set-CosmosDbCollectionType
- Set-CosmosDbDatabaseType
- Set-CosmosDbDocument
- Set-CosmosDbDocumentType
- Set-CosmosDbOffer
- Set-CosmosDbOfferType
- Set-CosmosDbPermissionType
- Set-CosmosDbStoredProcedure
- Set-CosmosDbStoredProcedureType
- Set-CosmosDbTrigger
- Set-CosmosDbTriggerType
- Set-CosmosDbUser
- Set-CosmosDbUserDefinedFunction
- Set-CosmosDbUserDefinedFunctionType
- Set-CosmosDbUserType