creating a vm using csharp fluent sdk

Dharshan M 0 Reputation points
2023-11-20T06:00:52.89+00:00

            var vm = azure.VirtualMachines.Define(vmName)
                    .WithRegion(location)
                    .WithExistingResourceGroup(groupName)
                    .WithExistingPrimaryNetworkInterface(nic)
                    .WithLatestWindowsImage("MicrosoftWindowsDesktop", "Win10", "22h2-pro")
                    .WithAdminUsername(adminUser)
                    .WithAdminPassword(adminPassword)
                    .WithComputerName(vmName)
                    .WithSize(VirtualMachineSizeTypes.StandardDS2V2)
                    .Create();


this is my code for creating a vm using fluent sdk and i'm not able to create the vm in windows 10 pro 22H2 x64 when i run the program it says :- "'The platform image 'MicrosoftWindowsDesktop:Windows-10:22h2-pro:latest' is not available. Verify that all fields in the storage profile are correct. For more details about storage profile information, please refer to https://aka.ms/storageprofile' "
will anyone help me to resolve this problem

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,901 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,560 questions
ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,489 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,933 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Dillon Silzer 57,491 Reputation points
    2023-11-22T03:48:30.7+00:00

    Hi Dharshan,

    I'm not sure you can deploy Windows 10 22H2 as it is not a default image. However, you can try Windows 11 as suggested below.

    Please see the following:

    How to deploy Windows 11 on Azure

    https://learn.microsoft.com/en-us/azure/virtual-machines/windows/windows-desktop-multitenant-hosting-deployment


    If this is helpful please accept answer.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.