빠른 시작: JavaScript를 사용하여 가상 머신에 Azure Automanage 사용

Azure Automanage를 사용하면 사용자가 가상 머신에 Azure 모범 사례를 원활하게 적용할 수 있습니다. 이 빠른 시작 가이드는 azure-sdk-for-js repo를 사용하여 기존 가상 머신에 모범 사례 구성 프로필을 적용하는 데 도움이 됩니다.

필수 조건

참고 항목

평가판 계정은 이 자습서에서 사용되는 가상 머신에 액세스할 수 없습니다. 종량제 구독으로 업그레이드하세요.

중요

Automanage를 사용하도록 설정하려면 VM이 포함된 리소스 그룹에 대한 기여자 역할이 있어야 합니다. 구독에서 처음으로 Automanage를 사용하도록 설정하는 경우 다음 권한이 필요합니다. 구독에 대한 사용자 액세스 관리자 역할과 함께 소유자 역할 또는 기여자

필요한 패키지를 설치합니다.

이 데모에서는 Azure IDAzure Automanage 패키지가 모두 필요합니다.

npm install @azure/arm-automanage
npm install @azure/identity

패키지 가져오기

Azure IDAzure Automanage 패키지를 스크립트로 가져옵니다.

const { AutomanageClient } = require("@azure/arm-automanage");
const { DefaultAzureCredential } = require("@azure/identity");

Azure에 인증하고 Automanage 클라이언트 만들기

Azure ID 패키지를 사용하여 Azure에 인증한 다음, Automanage 클라이언트를 만듭니다.

const credential = new DefaultAzureCredential();
const client = new AutomanageClient(credential, "<subscription ID>");

기존 가상 머신에 모범 사례 구성 프로필 사용

let assignment = {
    "properties": {
        "configurationProfile": "/providers/Microsoft.Automanage/bestPractices/AzureBestPracticesProduction"
    }
}

// assignment name must be named "default"
await client.configurationProfileAssignments.createOrUpdate("default", "resourceGroupName", "vmName", assignment);

다음 단계

azure-sdk-for-js repo를 방문하여 JavaScript Automanage Client를 사용하여 더 많은 작업을 수행하는 방법을 알아봅니다.