summary import { RoleInstances , ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function rebuildCloudServiceRoleInstances ( ) { const subscriptionId = "{subscription-id}" ; const resourceGroupName = "ConstosoRG" ; const cloudServiceName = "{cs-name}" ; const parameters = { roleInstances : [ "ContosoFrontend_IN_0" , "ContosoBackend_IN_1" ] } ; const options = { parameters : parameters } ; const credential = new DefaultAzureCredential ( ) ; const client = new ComputeManagementClient ( credential , subscriptionId ) ; const result = await client . cloudServices . beginRebuildAndWait ( resourceGroupName , cloudServiceName , options ) ; console . log ( result ) ; } rebuildCloudServiceRoleInstances ( ) . catch ( console . error ) ;