Listas las cadenas de conexión de la cuenta de base de datos de Azure Cosmos DB especificada.
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/listConnectionStrings?api-version=2023-11-15
Parámetros de identificador URI
Nombre |
En |
Requerido |
Tipo |
Description |
accountName
|
path |
True
|
string
|
Nombre de la cuenta de base de datos de Cosmos DB.
Regex pattern: ^[a-z0-9]+(-[a-z0-9]+)*
|
resourceGroupName
|
path |
True
|
string
|
Nombre del grupo de recursos. El nombre distingue mayúsculas de minúsculas.
|
subscriptionId
|
path |
True
|
string
|
Identificador de la suscripción de destino.
|
api-version
|
query |
True
|
string
|
Versión de API que se usará para la operación.
|
Respuestas
Seguridad
azure_auth
Flujo OAuth2 de Azure Active Directory
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Nombre |
Description |
user_impersonation
|
Suplantación de su cuenta de usuario
|
Ejemplos
CosmosDBDatabaseAccountListConnectionStrings
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/listConnectionStrings?api-version=2023-11-15
from azure.identity import DefaultAzureCredential
from azure.mgmt.cosmosdb import CosmosDBManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cosmosdb
# USAGE
python cosmos_db_database_account_list_connection_strings.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CosmosDBManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.database_accounts.list_connection_strings(
resource_group_name="rg1",
account_name="ddb1",
)
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcosmos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json
func ExampleDatabaseAccountsClient_ListConnectionStrings_cosmosDbDatabaseAccountListConnectionStrings() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcosmos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDatabaseAccountsClient().ListConnectionStrings(ctx, "rg1", "ddb1", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DatabaseAccountListConnectionStringsResult = armcosmos.DatabaseAccountListConnectionStringsResult{
// ConnectionStrings: []*armcosmos.DatabaseAccountConnectionString{
// {
// Type: to.Ptr(armcosmos.TypeSQL),
// Description: to.Ptr("Primary SQL Connection String"),
// ConnectionString: to.Ptr("connection-string"),
// KeyKind: to.Ptr(armcosmos.KindPrimary),
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the connection strings for the specified Azure Cosmos DB database account.
*
* @summary Lists the connection strings for the specified Azure Cosmos DB database account.
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStrings.json
*/
async function cosmosDbDatabaseAccountListConnectionStrings() {
const subscriptionId = process.env["COSMOSDB_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["COSMOSDB_RESOURCE_GROUP"] || "rg1";
const accountName = "ddb1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const result = await client.databaseAccounts.listConnectionStrings(
resourceGroupName,
accountName,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"connectionStrings": [
{
"connectionString": "connection-string",
"description": "Primary SQL Connection String",
"keyKind": "Primary",
"type": "Sql"
}
]
}
CosmosDBDatabaseAccountListConnectionStringsMongo
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/mongo-ddb1/listConnectionStrings?api-version=2023-11-15
from azure.identity import DefaultAzureCredential
from azure.mgmt.cosmosdb import CosmosDBManagementClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-cosmosdb
# USAGE
python cosmos_db_database_account_list_connection_strings_mongo.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = CosmosDBManagementClient(
credential=DefaultAzureCredential(),
subscription_id="subid",
)
response = client.database_accounts.list_connection_strings(
resource_group_name="rg1",
account_name="mongo-ddb1",
)
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json
if __name__ == "__main__":
main()
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
package armcosmos_test
import (
"context"
"log"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos/v2"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/41e4538ed7bb3ceac3c1322c9455a0812ed110ac/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json
func ExampleDatabaseAccountsClient_ListConnectionStrings_cosmosDbDatabaseAccountListConnectionStringsMongo() {
cred, err := azidentity.NewDefaultAzureCredential(nil)
if err != nil {
log.Fatalf("failed to obtain a credential: %v", err)
}
ctx := context.Background()
clientFactory, err := armcosmos.NewClientFactory("<subscription-id>", cred, nil)
if err != nil {
log.Fatalf("failed to create client: %v", err)
}
res, err := clientFactory.NewDatabaseAccountsClient().ListConnectionStrings(ctx, "rg1", "mongo-ddb1", nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
// You could use response here. We use blank identifier for just demo purposes.
_ = res
// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.
// res.DatabaseAccountListConnectionStringsResult = armcosmos.DatabaseAccountListConnectionStringsResult{
// ConnectionStrings: []*armcosmos.DatabaseAccountConnectionString{
// {
// Description: to.Ptr("Name of the connection string"),
// ConnectionString: to.Ptr("connection-string"),
// }},
// }
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
const { DefaultAzureCredential } = require("@azure/identity");
/**
* This sample demonstrates how to Lists the connection strings for the specified Azure Cosmos DB database account.
*
* @summary Lists the connection strings for the specified Azure Cosmos DB database account.
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBDatabaseAccountListConnectionStringsMongo.json
*/
async function cosmosDbDatabaseAccountListConnectionStringsMongo() {
const subscriptionId = process.env["COSMOSDB_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["COSMOSDB_RESOURCE_GROUP"] || "rg1";
const accountName = "mongo-ddb1";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const result = await client.databaseAccounts.listConnectionStrings(
resourceGroupName,
accountName,
);
console.log(result);
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
Sample Response
{
"connectionStrings": [
{
"connectionString": "connection-string",
"description": "Name of the connection string"
}
]
}
Definiciones
DatabaseAccountConnectionString
Cadena de conexión para la cuenta de Cosmos DB
Nombre |
Tipo |
Description |
connectionString
|
string
|
Valor del cadena de conexión
|
description
|
string
|
Descripción del cadena de conexión
|
keyKind
|
Kind
|
Tipo de clave de cadena de conexión
|
type
|
Type
|
Tipo del cadena de conexión
|
DatabaseAccountListConnectionStringsResult
Las cadenas de conexión de la cuenta de base de datos especificada.
Kind
Tipo de clave de cadena de conexión
Nombre |
Tipo |
Description |
Primary
|
string
|
|
PrimaryReadonly
|
string
|
|
Secondary
|
string
|
|
SecondaryReadonly
|
string
|
|
Type
Tipo del cadena de conexión
Nombre |
Tipo |
Description |
Cassandra
|
string
|
|
CassandraConnectorMetadata
|
string
|
|
Gremlin
|
string
|
|
GremlinV2
|
string
|
|
MongoDB
|
string
|
|
Sql
|
string
|
|
SqlDedicatedGateway
|
string
|
|
Table
|
string
|
|
Undefined
|
string
|
|