what is Microsoft.Azure.Management.ResourceManager.Fluent

nimi 91 Reputation points
2022-02-07T16:32:22.387+00:00

what is Microsoft.Azure.Management.ResourceManager.Fluent

Is this library is used for creating and deleting Azure vms?

Any Microsoft document related to this?

Azure Virtual Machines
Azure Virtual Machines
An Azure service that is used to provision Windows and Linux virtual machines.
7,130 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. kobulloc-MSFT 23,416 Reputation points Microsoft Employee
    2022-02-07T20:22:27.02+00:00

    Hello, @nimi !

    Microsoft.Azure.Management.ResourceManager.Fluent refers to the Fluent API, an older approach to resource group and resource management in Azure. I'll include some links to documentation below but moving forward I would focus on Azure.ResourceManager. For creating and deleting VMs, look at the VirtualMachine Class.

    Azure SDK for .NET - Azure.ResourceManager
    The next-generation of .NET SDK's management (or "management plane") libraries will help you create, provision, and manage Azure resources from within .NET applications. All Azure services have corresponding management libraries.

    With the management libraries (names beginning with Azure.ResourceManager, e.g. Azure.ResourceManager.Compute), you can write configuration and deployment programs to perform the same tasks that you can through the Azure portal, Azure CLI, or other resource management tools.

    172044-image.png

    Fluent API documentation and resources
    Documentation and resources for Microsoft.Azure.Management.ResourceManager.Fluent.

    0 comments No comments

  2. Chandra Shekhar Azad 1 Reputation point
    2022-10-17T12:33:00.33+00:00

    @Anonymous

    I have used Azure SDK for .NET - Azure.ResourceManager for start, stop and delete operation of vm on Azure and I am receiving the following error.

    Azure.ResourceManager System.NotImplementedException: The method or operation is not implemented.

        public async Task<ArmOperation> StartVM(string vmName)  
        {  
            ArmClient client = new ArmClient(new DefaultAzureCredential());  
            string resourceGroupName = "vm003";  
            SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();  
            ResourceGroupCollection resourceGroups = subscription.GetResourceGroups();  
            ResourceGroupResource resourceGroup = await resourceGroups.GetAsync(resourceGroupName);  
    
            var vm = resourceGroup.GetVirtualMachine(vmName);  
    
            var result = await vm.Value.PowerOnAsync(WaitUntil.Started);  
    
            return result;  
        }  
    
        [HttpPost("StopVM")]  
        public async Task<ArmOperation> StopVM(string vmName)  
        {  
            ArmClient client = new ArmClient(new DefaultAzureCredential());  
            string resourceGroupName = "vm003";  
            SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();  
            ResourceGroupCollection resourceGroups = subscription.GetResourceGroups();  
            ResourceGroupResource resourceGroup = await resourceGroups.GetAsync(resourceGroupName);  
    
            var vm = resourceGroup.GetVirtualMachine(vmName);  
    
            var result = await vm.Value.PowerOffAsync(WaitUntil.Completed);  
    
            return result;  
    
        }  
    
        [HttpPost("DeleteVM")]  
        public async Task<ArmOperation> DeleteVM(string vmName)  
        {  
            ArmClient client = new ArmClient(new DefaultAzureCredential());  
            string resourceGroupName = "vm003";  
            SubscriptionResource subscription = await client.GetDefaultSubscriptionAsync();  
            ResourceGroupCollection resourceGroups = subscription.GetResourceGroups();  
            ResourceGroupResource resourceGroup = await resourceGroups.GetAsync(resourceGroupName);  
    
            var vm = resourceGroup.GetVirtualMachine(vmName);  
    
            var result = await vm.Value.DeleteAsync(WaitUntil.Completed);  
    
            return result;  
    
        }  
    

    Could you please let me know why is this issue caused and the start or stop function actually leave the vm in un usable state. It doesn't start the vm completely or stop it completelly.

    I have to stop the vm in azure portal and start it again.