We recommend using Azure Native.
Azure v6.28.0 published on Friday, Oct 3, 2025 by Pulumi
azure.cosmosdb.getAccount
Start a Neo task
Explain and create an azure.cosmosdb.getAccount resource
Use this data source to access information about an existing CosmosDB (formally DocumentDB) Account.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.cosmosdb.getAccount({
name: "tfex-cosmosdb-account",
resourceGroupName: "tfex-cosmosdb-account-rg",
});
export const cosmosdbAccountEndpoint = example.then(example => example.endpoint);
import pulumi
import pulumi_azure as azure
example = azure.cosmosdb.get_account(name="tfex-cosmosdb-account",
resource_group_name="tfex-cosmosdb-account-rg")
pulumi.export("cosmosdbAccountEndpoint", example.endpoint)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/cosmosdb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := cosmosdb.LookupAccount(ctx, &cosmosdb.LookupAccountArgs{
Name: "tfex-cosmosdb-account",
ResourceGroupName: "tfex-cosmosdb-account-rg",
}, nil)
if err != nil {
return err
}
ctx.Export("cosmosdbAccountEndpoint", example.Endpoint)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.CosmosDB.GetAccount.Invoke(new()
{
Name = "tfex-cosmosdb-account",
ResourceGroupName = "tfex-cosmosdb-account-rg",
});
return new Dictionary<string, object?>
{
["cosmosdbAccountEndpoint"] = example.Apply(getAccountResult => getAccountResult.Endpoint),
};
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.cosmosdb.CosmosdbFunctions;
import com.pulumi.azure.cosmosdb.inputs.GetAccountArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = CosmosdbFunctions.getAccount(GetAccountArgs.builder()
.name("tfex-cosmosdb-account")
.resourceGroupName("tfex-cosmosdb-account-rg")
.build());
ctx.export("cosmosdbAccountEndpoint", example.endpoint());
}
}
variables:
example:
fn::invoke:
function: azure:cosmosdb:getAccount
arguments:
name: tfex-cosmosdb-account
resourceGroupName: tfex-cosmosdb-account-rg
outputs:
cosmosdbAccountEndpoint: ${example.endpoint}
API Providers
This data source uses the following Azure API Providers:
Microsoft.DocumentDB- 2024-08-15
Using getAccount
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getAccount(args: GetAccountArgs, opts?: InvokeOptions): Promise<GetAccountResult>
function getAccountOutput(args: GetAccountOutputArgs, opts?: InvokeOptions): Output<GetAccountResult>def get_account(name: Optional[str] = None,
resource_group_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetAccountResult
def get_account_output(name: Optional[pulumi.Input[str]] = None,
resource_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetAccountResult]func LookupAccount(ctx *Context, args *LookupAccountArgs, opts ...InvokeOption) (*LookupAccountResult, error)
func LookupAccountOutput(ctx *Context, args *LookupAccountOutputArgs, opts ...InvokeOption) LookupAccountResultOutput> Note: This function is named LookupAccount in the Go SDK.
public static class GetAccount
{
public static Task<GetAccountResult> InvokeAsync(GetAccountArgs args, InvokeOptions? opts = null)
public static Output<GetAccountResult> Invoke(GetAccountInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetAccountResult> getAccount(GetAccountArgs args, InvokeOptions options)
public static Output<GetAccountResult> getAccount(GetAccountArgs args, InvokeOptions options)
fn::invoke:
function: azure:cosmosdb/getAccount:getAccount
arguments:
# arguments dictionaryThe following arguments are supported:
- Name string
- Specifies the name of the CosmosDB Account.
- Resource
Group stringName - Specifies the name of the resource group in which the CosmosDB Account resides.
- Name string
- Specifies the name of the CosmosDB Account.
- Resource
Group stringName - Specifies the name of the resource group in which the CosmosDB Account resides.
- name String
- Specifies the name of the CosmosDB Account.
- resource
Group StringName - Specifies the name of the resource group in which the CosmosDB Account resides.
- name string
- Specifies the name of the CosmosDB Account.
- resource
Group stringName - Specifies the name of the resource group in which the CosmosDB Account resides.
- name str
- Specifies the name of the CosmosDB Account.
- resource_
group_ strname - Specifies the name of the resource group in which the CosmosDB Account resides.
- name String
- Specifies the name of the CosmosDB Account.
- resource
Group StringName - Specifies the name of the resource group in which the CosmosDB Account resides.
getAccount Result
The following output properties are available:
- Automatic
Failover boolEnabled - If automatic failover is enabled for this CosmosDB Account.
- Capabilities
List<Get
Account Capability> - Capabilities enabled on this Cosmos DB account.
- Consistency
Policies List<GetAccount Consistency Policy> - Endpoint string
- The endpoint used to connect to the CosmosDB account.
- Free
Tier boolEnabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- Geo
Locations List<GetAccount Geo Location> - Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Range stringFilter - The current IP Filter for this CosmosDB account
- Is
Virtual boolNetwork Filter Enabled - If virtual network filtering is enabled for this Cosmos DB account.
- Key
Vault stringKey Id - The Key Vault key URI for CMK encryption.
- Kind string
- The Kind of the CosmosDB account.
- Location string
- The name of the Azure region hosting replicated data.
- Multiple
Write boolLocations Enabled - If multiple write locations are enabled for this Cosmos DB account.
- Name string
- Offer
Type string - The Offer Type to used by this CosmosDB Account.
- Primary
Key string - The primary key for the CosmosDB account.
- Primary
Mongodb stringConnection String - The primary Mongodb connection string for the CosmosDB account.
- Primary
Readonly stringKey - The primary read-only Key for the CosmosDB account.
- Primary
Readonly stringMongodb Connection String - The primary readonly Mongodb connection string for the CosmosDB account.
- Primary
Readonly stringSql Connection String - The primary read-only SQL connection string for the CosmosDB account.
- Primary
Sql stringConnection String - The primary SQL connection string for the CosmosDB Account.
- Read
Endpoints List<string> - A list of read endpoints available for this CosmosDB account.
- Resource
Group stringName - Secondary
Key string - The secondary key for the CosmosDB account.
- Secondary
Mongodb stringConnection String - The secondary Mongodb connection string for the CosmosDB account.
- Secondary
Readonly stringKey - The secondary read-only key for the CosmosDB account.
- Secondary
Readonly stringMongodb Connection String - The secondary readonly Mongodb connection string for the CosmosDB account.
- Secondary
Readonly stringSql Connection String - The secondary read-only SQL connection string for the CosmosDB account.
- Secondary
Sql stringConnection String - The secondary SQL connection string for the CosmosDB Account.
- Dictionary<string, string>
- A mapping of tags assigned to the resource.
- Virtual
Network List<GetRules Account Virtual Network Rule> - Subnets that are allowed to access this CosmosDB account.
- Write
Endpoints List<string> - A list of write endpoints available for this CosmosDB account.
- Automatic
Failover boolEnabled - If automatic failover is enabled for this CosmosDB Account.
- Capabilities
[]Get
Account Capability - Capabilities enabled on this Cosmos DB account.
- Consistency
Policies []GetAccount Consistency Policy - Endpoint string
- The endpoint used to connect to the CosmosDB account.
- Free
Tier boolEnabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- Geo
Locations []GetAccount Geo Location - Id string
- The provider-assigned unique ID for this managed resource.
- Ip
Range stringFilter - The current IP Filter for this CosmosDB account
- Is
Virtual boolNetwork Filter Enabled - If virtual network filtering is enabled for this Cosmos DB account.
- Key
Vault stringKey Id - The Key Vault key URI for CMK encryption.
- Kind string
- The Kind of the CosmosDB account.
- Location string
- The name of the Azure region hosting replicated data.
- Multiple
Write boolLocations Enabled - If multiple write locations are enabled for this Cosmos DB account.
- Name string
- Offer
Type string - The Offer Type to used by this CosmosDB Account.
- Primary
Key string - The primary key for the CosmosDB account.
- Primary
Mongodb stringConnection String - The primary Mongodb connection string for the CosmosDB account.
- Primary
Readonly stringKey - The primary read-only Key for the CosmosDB account.
- Primary
Readonly stringMongodb Connection String - The primary readonly Mongodb connection string for the CosmosDB account.
- Primary
Readonly stringSql Connection String - The primary read-only SQL connection string for the CosmosDB account.
- Primary
Sql stringConnection String - The primary SQL connection string for the CosmosDB Account.
- Read
Endpoints []string - A list of read endpoints available for this CosmosDB account.
- Resource
Group stringName - Secondary
Key string - The secondary key for the CosmosDB account.
- Secondary
Mongodb stringConnection String - The secondary Mongodb connection string for the CosmosDB account.
- Secondary
Readonly stringKey - The secondary read-only key for the CosmosDB account.
- Secondary
Readonly stringMongodb Connection String - The secondary readonly Mongodb connection string for the CosmosDB account.
- Secondary
Readonly stringSql Connection String - The secondary read-only SQL connection string for the CosmosDB account.
- Secondary
Sql stringConnection String - The secondary SQL connection string for the CosmosDB Account.
- map[string]string
- A mapping of tags assigned to the resource.
- Virtual
Network []GetRules Account Virtual Network Rule - Subnets that are allowed to access this CosmosDB account.
- Write
Endpoints []string - A list of write endpoints available for this CosmosDB account.
- automatic
Failover BooleanEnabled - If automatic failover is enabled for this CosmosDB Account.
- capabilities
List<Get
Account Capability> - Capabilities enabled on this Cosmos DB account.
- consistency
Policies List<GetAccount Consistency Policy> - endpoint String
- The endpoint used to connect to the CosmosDB account.
- free
Tier BooleanEnabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- geo
Locations List<GetAccount Geo Location> - id String
- The provider-assigned unique ID for this managed resource.
- ip
Range StringFilter - The current IP Filter for this CosmosDB account
- is
Virtual BooleanNetwork Filter Enabled - If virtual network filtering is enabled for this Cosmos DB account.
- key
Vault StringKey Id - The Key Vault key URI for CMK encryption.
- kind String
- The Kind of the CosmosDB account.
- location String
- The name of the Azure region hosting replicated data.
- multiple
Write BooleanLocations Enabled - If multiple write locations are enabled for this Cosmos DB account.
- name String
- offer
Type String - The Offer Type to used by this CosmosDB Account.
- primary
Key String - The primary key for the CosmosDB account.
- primary
Mongodb StringConnection String - The primary Mongodb connection string for the CosmosDB account.
- primary
Readonly StringKey - The primary read-only Key for the CosmosDB account.
- primary
Readonly StringMongodb Connection String - The primary readonly Mongodb connection string for the CosmosDB account.
- primary
Readonly StringSql Connection String - The primary read-only SQL connection string for the CosmosDB account.
- primary
Sql StringConnection String - The primary SQL connection string for the CosmosDB Account.
- read
Endpoints List<String> - A list of read endpoints available for this CosmosDB account.
- resource
Group StringName - secondary
Key String - The secondary key for the CosmosDB account.
- secondary
Mongodb StringConnection String - The secondary Mongodb connection string for the CosmosDB account.
- secondary
Readonly StringKey - The secondary read-only key for the CosmosDB account.
- secondary
Readonly StringMongodb Connection String - The secondary readonly Mongodb connection string for the CosmosDB account.
- secondary
Readonly StringSql Connection String - The secondary read-only SQL connection string for the CosmosDB account.
- secondary
Sql StringConnection String - The secondary SQL connection string for the CosmosDB Account.
- Map<String,String>
- A mapping of tags assigned to the resource.
- virtual
Network List<GetRules Account Virtual Network Rule> - Subnets that are allowed to access this CosmosDB account.
- write
Endpoints List<String> - A list of write endpoints available for this CosmosDB account.
- automatic
Failover booleanEnabled - If automatic failover is enabled for this CosmosDB Account.
- capabilities
Get
Account Capability[] - Capabilities enabled on this Cosmos DB account.
- consistency
Policies GetAccount Consistency Policy[] - endpoint string
- The endpoint used to connect to the CosmosDB account.
- free
Tier booleanEnabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- geo
Locations GetAccount Geo Location[] - id string
- The provider-assigned unique ID for this managed resource.
- ip
Range stringFilter - The current IP Filter for this CosmosDB account
- is
Virtual booleanNetwork Filter Enabled - If virtual network filtering is enabled for this Cosmos DB account.
- key
Vault stringKey Id - The Key Vault key URI for CMK encryption.
- kind string
- The Kind of the CosmosDB account.
- location string
- The name of the Azure region hosting replicated data.
- multiple
Write booleanLocations Enabled - If multiple write locations are enabled for this Cosmos DB account.
- name string
- offer
Type string - The Offer Type to used by this CosmosDB Account.
- primary
Key string - The primary key for the CosmosDB account.
- primary
Mongodb stringConnection String - The primary Mongodb connection string for the CosmosDB account.
- primary
Readonly stringKey - The primary read-only Key for the CosmosDB account.
- primary
Readonly stringMongodb Connection String - The primary readonly Mongodb connection string for the CosmosDB account.
- primary
Readonly stringSql Connection String - The primary read-only SQL connection string for the CosmosDB account.
- primary
Sql stringConnection String - The primary SQL connection string for the CosmosDB Account.
- read
Endpoints string[] - A list of read endpoints available for this CosmosDB account.
- resource
Group stringName - secondary
Key string - The secondary key for the CosmosDB account.
- secondary
Mongodb stringConnection String - The secondary Mongodb connection string for the CosmosDB account.
- secondary
Readonly stringKey - The secondary read-only key for the CosmosDB account.
- secondary
Readonly stringMongodb Connection String - The secondary readonly Mongodb connection string for the CosmosDB account.
- secondary
Readonly stringSql Connection String - The secondary read-only SQL connection string for the CosmosDB account.
- secondary
Sql stringConnection String - The secondary SQL connection string for the CosmosDB Account.
- {[key: string]: string}
- A mapping of tags assigned to the resource.
- virtual
Network GetRules Account Virtual Network Rule[] - Subnets that are allowed to access this CosmosDB account.
- write
Endpoints string[] - A list of write endpoints available for this CosmosDB account.
- automatic_
failover_ boolenabled - If automatic failover is enabled for this CosmosDB Account.
- capabilities
Sequence[Get
Account Capability] - Capabilities enabled on this Cosmos DB account.
- consistency_
policies Sequence[GetAccount Consistency Policy] - endpoint str
- The endpoint used to connect to the CosmosDB account.
- free_
tier_ boolenabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- geo_
locations Sequence[GetAccount Geo Location] - id str
- The provider-assigned unique ID for this managed resource.
- ip_
range_ strfilter - The current IP Filter for this CosmosDB account
- is_
virtual_ boolnetwork_ filter_ enabled - If virtual network filtering is enabled for this Cosmos DB account.
- key_
vault_ strkey_ id - The Key Vault key URI for CMK encryption.
- kind str
- The Kind of the CosmosDB account.
- location str
- The name of the Azure region hosting replicated data.
- multiple_
write_ boollocations_ enabled - If multiple write locations are enabled for this Cosmos DB account.
- name str
- offer_
type str - The Offer Type to used by this CosmosDB Account.
- primary_
key str - The primary key for the CosmosDB account.
- primary_
mongodb_ strconnection_ string - The primary Mongodb connection string for the CosmosDB account.
- primary_
readonly_ strkey - The primary read-only Key for the CosmosDB account.
- primary_
readonly_ strmongodb_ connection_ string - The primary readonly Mongodb connection string for the CosmosDB account.
- primary_
readonly_ strsql_ connection_ string - The primary read-only SQL connection string for the CosmosDB account.
- primary_
sql_ strconnection_ string - The primary SQL connection string for the CosmosDB Account.
- read_
endpoints Sequence[str] - A list of read endpoints available for this CosmosDB account.
- resource_
group_ strname - secondary_
key str - The secondary key for the CosmosDB account.
- secondary_
mongodb_ strconnection_ string - The secondary Mongodb connection string for the CosmosDB account.
- secondary_
readonly_ strkey - The secondary read-only key for the CosmosDB account.
- secondary_
readonly_ strmongodb_ connection_ string - The secondary readonly Mongodb connection string for the CosmosDB account.
- secondary_
readonly_ strsql_ connection_ string - The secondary read-only SQL connection string for the CosmosDB account.
- secondary_
sql_ strconnection_ string - The secondary SQL connection string for the CosmosDB Account.
- Mapping[str, str]
- A mapping of tags assigned to the resource.
- virtual_
network_ Sequence[Getrules Account Virtual Network Rule] - Subnets that are allowed to access this CosmosDB account.
- write_
endpoints Sequence[str] - A list of write endpoints available for this CosmosDB account.
- automatic
Failover BooleanEnabled - If automatic failover is enabled for this CosmosDB Account.
- capabilities List<Property Map>
- Capabilities enabled on this Cosmos DB account.
- consistency
Policies List<Property Map> - endpoint String
- The endpoint used to connect to the CosmosDB account.
- free
Tier BooleanEnabled - If Free Tier pricing option is enabled for this CosmosDB Account. You can have up to one free tier Azure Cosmos DB account per Azure subscription.
- geo
Locations List<Property Map> - id String
- The provider-assigned unique ID for this managed resource.
- ip
Range StringFilter - The current IP Filter for this CosmosDB account
- is
Virtual BooleanNetwork Filter Enabled - If virtual network filtering is enabled for this Cosmos DB account.
- key
Vault StringKey Id - The Key Vault key URI for CMK encryption.
- kind String
- The Kind of the CosmosDB account.
- location String
- The name of the Azure region hosting replicated data.
- multiple
Write BooleanLocations Enabled - If multiple write locations are enabled for this Cosmos DB account.
- name String
- offer
Type String - The Offer Type to used by this CosmosDB Account.
- primary
Key String - The primary key for the CosmosDB account.
- primary
Mongodb StringConnection String - The primary Mongodb connection string for the CosmosDB account.
- primary
Readonly StringKey - The primary read-only Key for the CosmosDB account.
- primary
Readonly StringMongodb Connection String - The primary readonly Mongodb connection string for the CosmosDB account.
- primary
Readonly StringSql Connection String - The primary read-only SQL connection string for the CosmosDB account.
- primary
Sql StringConnection String - The primary SQL connection string for the CosmosDB Account.
- read
Endpoints List<String> - A list of read endpoints available for this CosmosDB account.
- resource
Group StringName - secondary
Key String - The secondary key for the CosmosDB account.
- secondary
Mongodb StringConnection String - The secondary Mongodb connection string for the CosmosDB account.
- secondary
Readonly StringKey - The secondary read-only key for the CosmosDB account.
- secondary
Readonly StringMongodb Connection String - The secondary readonly Mongodb connection string for the CosmosDB account.
- secondary
Readonly StringSql Connection String - The secondary read-only SQL connection string for the CosmosDB account.
- secondary
Sql StringConnection String - The secondary SQL connection string for the CosmosDB Account.
- Map<String>
- A mapping of tags assigned to the resource.
- virtual
Network List<Property Map>Rules - Subnets that are allowed to access this CosmosDB account.
- write
Endpoints List<String> - A list of write endpoints available for this CosmosDB account.
Supporting Types
GetAccountCapability
- Name string
- Specifies the name of the CosmosDB Account.
- Name string
- Specifies the name of the CosmosDB Account.
- name String
- Specifies the name of the CosmosDB Account.
- name string
- Specifies the name of the CosmosDB Account.
- name str
- Specifies the name of the CosmosDB Account.
- name String
- Specifies the name of the CosmosDB Account.
GetAccountConsistencyPolicy
- Consistency
Level string - The Consistency Level used by this CosmosDB Account.
- Max
Interval intIn Seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- Max
Staleness intPrefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
- Consistency
Level string - The Consistency Level used by this CosmosDB Account.
- Max
Interval intIn Seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- Max
Staleness intPrefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
- consistency
Level String - The Consistency Level used by this CosmosDB Account.
- max
Interval IntegerIn Seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- max
Staleness IntegerPrefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
- consistency
Level string - The Consistency Level used by this CosmosDB Account.
- max
Interval numberIn Seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- max
Staleness numberPrefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
- consistency_
level str - The Consistency Level used by this CosmosDB Account.
- max_
interval_ intin_ seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- max_
staleness_ intprefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
- consistency
Level String - The Consistency Level used by this CosmosDB Account.
- max
Interval NumberIn Seconds - The amount of staleness (in seconds) tolerated when the consistency level is Bounded Staleness.
- max
Staleness NumberPrefix - The number of stale requests tolerated when the consistency level is Bounded Staleness.
GetAccountGeoLocation
- Failover
Priority int - Id string
- The ID of the virtual network subnet.
- Location string
- The name of the Azure region hosting replicated data.
- Failover
Priority int - Id string
- The ID of the virtual network subnet.
- Location string
- The name of the Azure region hosting replicated data.
- failover
Priority Integer - id String
- The ID of the virtual network subnet.
- location String
- The name of the Azure region hosting replicated data.
- failover
Priority number - id string
- The ID of the virtual network subnet.
- location string
- The name of the Azure region hosting replicated data.
- failover_
priority int - id str
- The ID of the virtual network subnet.
- location str
- The name of the Azure region hosting replicated data.
- failover
Priority Number - id String
- The ID of the virtual network subnet.
- location String
- The name of the Azure region hosting replicated data.
GetAccountVirtualNetworkRule
- Id string
- The ID of the virtual network subnet.
- Id string
- The ID of the virtual network subnet.
- id String
- The ID of the virtual network subnet.
- id string
- The ID of the virtual network subnet.
- id str
- The ID of the virtual network subnet.
- id String
- The ID of the virtual network subnet.
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
azurermTerraform Provider.
