Files
e1b671e43d [AutoPR @azure-arm-machinelearning]-generated-from-SDK Generation - JS-6492167 (#38998)
Configurations:
'specification/machinelearningservices/MachineLearningServices.Management/tspconfig.yaml',
API Version: 2026-03-15-preview, SDK Release Type: beta, and CommitSHA:
'dfef10d031a60f8e2fcf36e99364c144e9661036' in SpecRepo:
'https://github.com/Azure/azure-rest-api-specs' Pipeline run:
https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6492167
Refer to
https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites
to prepare for SDK release.

---------

Co-authored-by: Jiao Di (MSFT) <[email protected]>
Co-authored-by: Jiao Di (MSFT) <[email protected]>
2026-06-29 12:59:37 +08:00

70 lines
3.0 KiB
TypeScript

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { AzureMachineLearningServicesManagementClient } from "@azure/arm-machinelearning";
import { DefaultAzureCredential } from "@azure/identity";
/**
* This sample demonstrates how to creates or updates a workspace with the specified parameters.
*
* @summary creates or updates a workspace with the specified parameters.
* x-ms-original-file: 2026-03-15-preview/Workspace/create.json
*/
async function createWorkspace(): Promise<void> {
const credential = new DefaultAzureCredential();
const subscriptionId = "00000000-1111-2222-3333-444444444444";
const client = new AzureMachineLearningServicesManagementClient(credential, subscriptionId);
const result = await client.workspaces.createOrUpdate("workspace-1234", "testworkspace", {
identity: {
type: "SystemAssigned,UserAssigned",
userAssignedIdentities: {
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testuai":
{},
},
},
location: "eastus2euap",
description: "test description",
applicationInsights:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/microsoft.insights/components/testinsights",
containerRegistry:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.ContainerRegistry/registries/testRegistry",
encryption: {
identity: {
userAssignedIdentity:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.ManagedIdentity/userAssignedIdentities/testuai",
},
keyVaultProperties: {
identityClientId: "",
keyIdentifier:
"https://testkv.vault.azure.net/keys/testkey/aabbccddee112233445566778899aabb",
keyVaultArmId:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.KeyVault/vaults/testkv",
},
status: "Enabled",
},
friendlyName: "HelloName",
hbiWorkspace: false,
keyVault:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.KeyVault/vaults/testkv",
sharedPrivateLinkResources: [
{
name: "testdbresource",
groupId: "Sql",
privateLinkResourceId:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/workspace-1234/providers/Microsoft.DocumentDB/databaseAccounts/testdbresource/privateLinkResources/Sql",
requestMessage: "Please approve",
status: "Approved",
},
],
storageAccount:
"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/accountcrud-1234/providers/Microsoft.Storage/storageAccounts/testStorageAccount",
});
console.log(result);
}
async function main(): Promise<void> {
await createWorkspace();
}
main().catch(console.error);