Retrieves the connection info for the notebook workspace
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/default/listConnectionInfo?api-version=2024-08-15
URI Parameters
Name |
In |
Required |
Type |
Description |
accountName
|
path |
True
|
string
|
Cosmos DB database account name.
Regex pattern: ^[a-z0-9]+(-[a-z0-9]+)*
|
notebookWorkspaceName
|
path |
True
|
NotebookWorkspaceName
|
The name of the notebook workspace resource.
|
resourceGroupName
|
path |
True
|
string
|
The name of the resource group. The name is case insensitive.
|
subscriptionId
|
path |
True
|
string
|
The ID of the target subscription.
|
api-version
|
query |
True
|
string
|
The API version to use for this operation.
|
Responses
Security
azure_auth
Azure Active Directory OAuth2 Flow
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
Name |
Description |
user_impersonation
|
Impersonate your user account
|
Examples
CosmosDBNotebookWorkspaceListConnectionInfo
Sample request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/notebookWorkspaces/default/listConnectionInfo?api-version=2024-08-15
import com.azure.resourcemanager.cosmos.models.NotebookWorkspaceName;
/**
* Samples for NotebookWorkspaces ListConnectionInfo.
*/
public final class Main {
/*
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/
* CosmosDBNotebookWorkspaceListConnectionInfo.json
*/
/**
* Sample code: CosmosDBNotebookWorkspaceListConnectionInfo.
*
* @param azure The entry point for accessing resource management APIs in Azure.
*/
public static void
cosmosDBNotebookWorkspaceListConnectionInfo(com.azure.resourcemanager.AzureResourceManager azure) {
azure.cosmosDBAccounts().manager().serviceClient().getNotebookWorkspaces().listConnectionInfoWithResponse("rg1",
"ddb1", NotebookWorkspaceName.DEFAULT, com.azure.core.util.Context.NONE);
}
}
To use the Azure SDK library in your project, see this documentation. To provide feedback on this code sample, open a GitHub issue
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_notebook_workspace_list_connection_info.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.notebook_workspaces.list_connection_info(
resource_group_name="rg1",
account_name="ddb1",
notebook_workspace_name="default",
)
print(response)
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.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/v3"
)
// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4d065866a422257746306b352cb34fd5c98d5754/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json
func ExampleNotebookWorkspacesClient_ListConnectionInfo() {
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.NewNotebookWorkspacesClient().ListConnectionInfo(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, 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.NotebookWorkspaceConnectionInfoResult = armcosmos.NotebookWorkspaceConnectionInfoResult{
// AuthToken: to.Ptr("auth-token"),
// NotebookServerEndpoint: to.Ptr("notebook endpoint"),
// }
}
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 Retrieves the connection info for the notebook workspace
*
* @summary Retrieves the connection info for the notebook workspace
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2024-08-15/examples/CosmosDBNotebookWorkspaceListConnectionInfo.json
*/
async function cosmosDbNotebookWorkspaceListConnectionInfo() {
const subscriptionId = process.env["COSMOSDB_SUBSCRIPTION_ID"] || "subid";
const resourceGroupName = process.env["COSMOSDB_RESOURCE_GROUP"] || "rg1";
const accountName = "ddb1";
const notebookWorkspaceName = "default";
const credential = new DefaultAzureCredential();
const client = new CosmosDBManagementClient(credential, subscriptionId);
const result = await client.notebookWorkspaces.listConnectionInfo(
resourceGroupName,
accountName,
notebookWorkspaceName,
);
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
{
"authToken": "auth-token",
"notebookServerEndpoint": "notebook endpoint"
}
Definitions
ErrorResponse
Error Response.
Name |
Type |
Description |
code
|
string
|
Error code.
|
message
|
string
|
Error message indicating why the operation failed.
|
NotebookWorkspaceConnectionInfoResult
The connection info for the given notebook workspace
Name |
Type |
Description |
authToken
|
string
|
Specifies auth token used for connecting to Notebook server (uses token-based auth).
|
notebookServerEndpoint
|
string
|
Specifies the endpoint of Notebook server.
|
NotebookWorkspaceName
The name of the notebook workspace resource.
Name |
Type |
Description |
default
|
string
|
|