ノートブック ワークスペースの認証トークンを再生成します
POST https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/notebookWorkspaces/default/regenerateAuthToken?api-version=2023-11-15
URI パラメーター
名前 |
/ |
必須 |
型 |
説明 |
accountName
|
path |
True
|
string
|
Cosmos DB データベース アカウント名。
Regex pattern: ^[a-z0-9]+(-[a-z0-9]+)*
|
notebookWorkspaceName
|
path |
True
|
NotebookWorkspaceName
|
ノートブック ワークスペース リソースの名前。
|
resourceGroupName
|
path |
True
|
string
|
リソース グループの名前。 名前の大文字と小文字は区別されます。
|
subscriptionId
|
path |
True
|
string
|
ターゲット サブスクリプションの ID。
|
api-version
|
query |
True
|
string
|
この操作に使用する API バージョン。
|
応答
名前 |
型 |
説明 |
200 OK
|
|
OK
|
202 Accepted
|
|
受理されました。 認証トークンの再生成操作は非同期的に完了します。
|
Other Status Codes
|
ErrorResponse
|
操作に失敗した理由を説明するエラー応答。
|
セキュリティ
azure_auth
Azure Active Directory OAuth2 フロー
Type:
oauth2
Flow:
implicit
Authorization URL:
https://login.microsoftonline.com/common/oauth2/authorize
Scopes
名前 |
説明 |
user_impersonation
|
ユーザー アカウントの借用
|
例
CosmosDBNotebookWorkspaceRegenerateAuthToken
Sample Request
POST https://management.azure.com/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.DocumentDB/databaseAccounts/ddb1/notebookWorkspaces/default/regenerateAuthToken?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_notebook_workspace_regenerate_auth_token.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",
)
client.notebook_workspaces.begin_regenerate_auth_token(
resource_group_name="rg1",
account_name="ddb1",
notebook_workspace_name="default",
).result()
# x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.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/CosmosDBNotebookWorkspaceRegenerateAuthToken.json
func ExampleNotebookWorkspacesClient_BeginRegenerateAuthToken() {
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)
}
poller, err := clientFactory.NewNotebookWorkspacesClient().BeginRegenerateAuthToken(ctx, "rg1", "ddb1", armcosmos.NotebookWorkspaceNameDefault, nil)
if err != nil {
log.Fatalf("failed to finish the request: %v", err)
}
_, err = poller.PollUntilDone(ctx, nil)
if err != nil {
log.Fatalf("failed to pull the result: %v", err)
}
}
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 Regenerates the auth token for the notebook workspace
*
* @summary Regenerates the auth token for the notebook workspace
* x-ms-original-file: specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-11-15/examples/CosmosDBNotebookWorkspaceRegenerateAuthToken.json
*/
async function cosmosDbNotebookWorkspaceRegenerateAuthToken() {
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.beginRegenerateAuthTokenAndWait(
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
Location: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2023-11-15
Azure-AsyncOperation: https://centraluseuap.management.azure.com/subscriptions/d1eb41bc-1b7f-4404-bd2a-8568c222852d/providers/Microsoft.DocumentDB/locations/centraluseuap/operationsStatus/fdd04b7b-86d5-460f-b19e-386230348bcc?api-version=2023-11-15
定義
ErrorResponse
エラー応答。
名前 |
型 |
説明 |
code
|
string
|
エラー コード。
|
message
|
string
|
操作が失敗した理由を示すエラー メッセージ。
|
NotebookWorkspaceName
ノートブック ワークスペース リソースの名前。