다음을 통해 공유


Azure Resource Manager를 사용하여 Machine Learning 스튜디오(클래식) 작업 영역 배포

적용 대상:적용 대상.Machine Learning Studio(클래식) 적용되지 않는 대상Azure Machine Learning

중요

Machine Learning Studio(클래식)에 대한 지원은 2024년 8월 31일에 종료됩니다. 해당 날짜까지 Azure Machine Learning으로 전환하는 것이 좋습니다.

2021년 12월 1일부터 새로운 Machine Learning Studio(클래식) 리소스를 만들 수 없습니다. 2024년 8월 31일까지는 기존 Machine Learning Studio(클래식) 리소스를 계속 사용할 수 있습니다.

ML Studio(클래식) 설명서는 사용 중지되며 나중에 업데이트되지 않을 수 있습니다.

Azure Resource Manager 배포 템플릿을 사용하면 유효성 검사와 상호 연결된 구성 요소를 배포하고 메커니즘을 다시 시도하는 확장성 있는 방법을 제공하여 시간을 절약할 수 있습니다. 예를 들어, Machine Learning 스튜디오(클래식) 작업 영역을 설정하려면 먼저 Azure Storage 계정을 구성한 다음, 작업 영역을 배포해야 합니다. 수백 개의 작업 영역에 대해 이 작업을 수동으로 수행한다고 가정합니다. 쉬운 대안은 Azure Resource Manager 템플릿을 사용하여 Studio(클래식) 작업 영역 및 모든 종속성을 배포하는 것입니다. 이 문서는 이 과정을 단계별로 안내합니다. Azure Resource Manager에 대한 개요는 Azure Resource Manager 개요를 참조하세요.

참고

Azure Az PowerShell 모듈을 사용하여 Azure와 상호 작용하는 것이 좋습니다. 시작하려면 Azure PowerShell 설치를 참조하세요. Az PowerShell 모듈로 마이그레이션하는 방법에 대한 자세한 내용은 Azure PowerShell을 AzureRM에서 Azure로 마이그레이션을 참조하세요.

단계별: Machine Learning 작업 영역 만들기

Azure 리소스 그룹을 만든 다음, Resource Manager 템플릿을 사용하여 새 Azure Storage 계정과 새 Machine Learning 스튜디오(클래식) 작업 영역을 배포합니다. 배포가 완료되면 생성된 작업 영역에 대한 중요한 정보를 인쇄합니다(기본 키, workspaceID 및 작업 영역에 대한 URL).

Azure Resource Manager 템플릿 생성

Machine Learning 작업 영역은 연결된 데이터 세트를 저장하려면 Azure Storage 계정이 필요합니다. 다음 템플릿은 리소스 그룹의 이름을 사용하여 스토리지 계정 이름 및 작업 영역 이름을 생성합니다. 또한 작업 영역을 만들 때 속성으로 스토리지 계정 이름을 사용합니다.

{
    "contentVersion": "1.0.0.0",
    "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
    "variables": {
        "namePrefix": "[resourceGroup().name]",
        "location": "[resourceGroup().location]",
        "mlVersion": "2016-04-01",
        "stgVersion": "2015-06-15",
        "storageAccountName": "[concat(variables('namePrefix'),'stg')]",
        "mlWorkspaceName": "[concat(variables('namePrefix'),'mlwk')]",
        "mlResourceId": "[resourceId('Microsoft.MachineLearning/workspaces', variables('mlWorkspaceName'))]",
        "stgResourceId": "[resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName'))]",
        "storageAccountType": "Standard_LRS"
    },
    "resources": [
        {
            "apiVersion": "[variables('stgVersion')]",
            "name": "[variables('storageAccountName')]",
            "type": "Microsoft.Storage/storageAccounts",
            "location": "[variables('location')]",
            "properties": {
                "accountType": "[variables('storageAccountType')]"
            }
        },
        {
            "apiVersion": "[variables('mlVersion')]",
            "type": "Microsoft.MachineLearning/workspaces",
            "name": "[variables('mlWorkspaceName')]",
            "location": "[variables('location')]",
            "dependsOn": ["[variables('stgResourceId')]"],
            "properties": {
                "UserStorageAccountId": "[variables('stgResourceId')]"
            }
        }
    ],
    "outputs": {
        "mlWorkspaceObject": {"type": "object", "value": "[reference(variables('mlResourceId'), variables('mlVersion'))]"},
        "mlWorkspaceToken": {"type": "string", "value": "[listWorkspaceKeys(variables('mlResourceId'), variables('mlVersion')).primaryToken]"},
        "mlWorkspaceWorkspaceID": {"type": "string", "value": "[reference(variables('mlResourceId'), variables('mlVersion')).WorkspaceId]"},
        "mlWorkspaceWorkspaceLink": {"type": "string", "value": "[concat('https://studio.azureml.net/Home/ViewWorkspace/', reference(variables('mlResourceId'), variables('mlVersion')).WorkspaceId)]"}
    }
}

c:\temp 아래에 mlworkspace.json 파일로 이 템플릿을 저장합니다.

템플릿을 기반으로 리소스 그룹 배포

  • PowerShell 열기
  • Azure Resource Manager 및 Azure 서비스 관리에 대한 모듈 설치
# Install the Azure Resource Manager modules from the PowerShell Gallery (press "A")
Install-Module Az -Scope CurrentUser

# Install the Azure Service Management modules from the PowerShell Gallery (press "A")
Install-Module Azure -Scope CurrentUser

이러한 단계는 나머지 단계를 완료하는 데 필요한 모듈을 다운로드 및 설치합니다. PowerShell 명령을 실행하는 환경에서 한 번만 수행하면 됩니다.

  • Azure에 대한 인증
# Authenticate (enter your credentials in the pop-up window)
Connect-AzAccount

이 단계는 각 세션에 대해 반복해야 합니다. 인증되면 구독 정보가 표시됩니다.

Azure 계정

이제 Azure에 대한 액세스가 있으므로 리소스 그룹을 만들 수 있습니다.

  • 리소스 그룹 만들기
$rg = New-AzResourceGroup -Name "uniquenamerequired523" -Location "South Central US"
$rg

리소스 그룹이 올바르게 프로비전되었는지 확인합니다. ProvisioningState는 "Succeeded"여야 합니다. 리소스 그룹 이름은 템플릿에서 스토리지 계정 이름을 생성하는 데 사용됩니다. 스토리지 계정 이름은 3자에서 24자 사이여야 하고 숫자 및 소문자만 사용해야 합니다.

리소스 그룹

  • 리소스 그룹 배포를 사용하여 새 Machine Learning 작업 영역을 배포합니다.
# Create a Resource Group, TemplateFile is the location of the JSON template.
$rgd = New-AzResourceGroupDeployment -Name "demo" -TemplateFile "C:\temp\mlworkspace.json" -ResourceGroupName $rg.ResourceGroupName

배포가 완료되면 배포한 작업 영역의 속성에 액세스하는 것은 간단합니다. 예를 들어 기본 키 토큰에 액세스할 수 있습니다.

# Access Machine Learning Studio (classic) Workspace Token after its deployment.
$rgd.Outputs.mlWorkspaceToken.Value

기존 작업 영역의 토큰을 검색하는 또 다른 방법은 Invoke-AzResourceAction 명령을 사용하는 것입니다. 예를 들어 모든 작업 영역의 기본 및 보조 토큰을 나열할 수 있습니다.

# List the primary and secondary tokens of all workspaces
Get-AzResource |? { $_.ResourceType -Like "*MachineLearning/workspaces*"} |ForEach-Object { Invoke-AzResourceAction -ResourceId $_.ResourceId -Action listworkspacekeys -Force}

작업 영역이 프로비저닝되면 Machine Learning 스튜디오(클래식)용 PowerShell 모듈을 사용하여 많은 Machine Learning 스튜디오(클래식) 작업을 자동화할 수도 있습니다.

다음 단계