1

I am trying to create VM scale set using an existing galery image version (specialized) like this:

using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.Compute.Fluent;
...
IGalleryImageVersion image = ...
IVirtualMachineScaleSet vmss = await Azure.VirtualMachineScaleSets
    .Define(vmssName)
    .WithRegion(region)
    .WithExistingResourceGroup(rgName)
    .WithSku(sku)
    .WithExistingPrimaryNetworkSubnet(network, subnetName)
    .WithoutPrimaryInternetFacingLoadBalancer()
    .WithoutPrimaryInternalLoadBalancer()
    .WithLinuxGalleryImageVersion(image.Id)
    .WithRootUsername(userName)
    .WithSsh(publicKey)
    .WithNewDataDisk(dataDiskSize)
    .WithCapacity(intendedSize)
    .WithExistingUserAssignedManagedServiceIdentity(identity)
    .WithVirtualMachinePublicIp()
    .CreateAsync(token);

What am I doing wrong? I am getting this exception:

Microsoft.Rest.Azure.CloudException
  HResult=0x80131500
  Message=Parameter 'osProfile' is not allowed.
  Source=Microsoft.Azure.Management.Compute.Fluent
  StackTrace:
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetsOperations.<BeginCreateOrUpdateWithHttpMessagesAsync>d__27.MoveNext()
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetsOperations.<CreateOrUpdateWithHttpMessagesAsync>d__5.MoveNext()
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetsOperationsExtensions.<CreateOrUpdateAsync>d__0.MoveNext()
   at Microsoft.Azure.Management.Compute.Fluent.VirtualMachineScaleSetImpl.<CreateInnerAsync>d__474.MoveNext()
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.GroupableParentResource`8.<CreateResourceAsync>d__5.MoveNext()
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.ResourceActions.Creatable`4.<Microsoft-Azure-Management-ResourceManager-Fluent-Core-ResourceActions-IResourceCreator<IResourceT>-CreateResourceAsync>d__15.MoveNext()
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.CreatorTaskItem`1.<ExecuteAsync>d__6.MoveNext()
   at Microsoft.Azure.Management.ResourceManager.Fluent.Core.DAG.TaskGroupBase`1.<ExecuteNodeTaskAsync>d__14.MoveNext()

I can create VMSS using a standard Linux image from marketplace. But I need to create VMSS with my own image from my own gallery. Note that the Fluent API does not give an option to omit root user name/ssh key from the call.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.