summary import { CloudService , ComputeManagementClient } from "@msinternal/compute-resource-manager" ; import { DefaultAzureCredential } from "@azure/identity" ; async function createNewCloudServiceWithMultipleRoles ( ) { const subscriptionId = "{subscription-id}" ; const resourceGroupName = "ConstosoRG" ; const cloudServiceName = "{cs-name}" ; const parameters = { location : "westus" , properties : { configuration : "{ServiceConfiguration}" , networkProfile : { loadBalancerConfigurations : [ { name : "contosolb" , properties : { frontendIPConfigurations : [ { name : "contosofe" , properties : { publicIPAddress : { id : "/subscriptions/{subscription-id}/resourceGroups/ConstosoRG/providers/Microsoft.Network/publicIPAddresses/contosopublicip" } } } ] } } ] } , packageUrl : "{PackageUrl}" , roleProfile : { roles : [ { name : "ContosoFrontend" , sku : { name : "Standard_D1_v2" , capacity : 1 , tier : "Standard" } } , { name : "ContosoBackend" , sku : { name : "Standard_D1_v2" , capacity : 1 , tier : "Standard" } } ] } , upgradeMode : "Auto" } } ; const options = { parameters : parameters } ; const credential = new DefaultAzureCredential ( ) ; const client = new ComputeManagementClient ( credential , subscriptionId ) ; const result = await client . cloudServices . beginCreateOrUpdateAndWait ( resourceGroupName , cloudServiceName , options ) ; console . log ( result ) ; } createNewCloudServiceWithMultipleRoles ( ) . catch ( console . error ) ;