Unable to create azure vm using powershell

Ujjval 0 Reputation points
2024-09-11T06:05:18.85+00:00

I am unable to create azure vm using powershell.

Error and Script are attached azurevm.txt and error.txt

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

2 answers

Sort by: Most helpful
  1. Lijitha B 515 Reputation points Moderator
    2024-09-11T08:55:21.47+00:00

    Hi Ujjval,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    The error message shows you've encountered an error when trying to access the subscription with the ID "9896b81a-ef21-45ad-8577-f6adde85abea". The error message indicates that the subscription was not found.

    Re-authenticate with Azure: Run the Connect-AzAccount cmdlet again to ensure you are authenticated correctly.

    Verify the subscription ID: Double-check the subscription ID and make sure it matches the one you retrieved earlier.

    Check subscription existence: Verify that the subscription exists and is active in your Azure account.

    Despite the error message, it looks like myVM was successfully created in mynewresourcegroup which I could see from the error logs. Can you please check in which subscription this vm is created.

    The below document provides you with detailed steps to deploy an azure virtual machine using powershell.
    Create a Windows virtual machine in Azure with PowerShell

    If you feel that your quires have been resolved, please accept the answer by clicking the "Upvote" and "Accept Answer" on the post.


  2. Jing Zhou 7,765 Reputation points Microsoft External Staff
    2024-09-12T01:55:00.89+00:00

    Hello,

     

    Thank you for posting in Q&A forum.

    The error message:

     

    {

     

    "error": {

     

    "code": "SubscriptionNotFound",

     

    "message": "Subscription 9896b81a-ef21-45ad-8577-f6adde85abea was not found."

     

    }

     

    indicates that you are assigning a wrong subscription.

     

    Please kindly check your subscriptions using the Azure portal or by running the following PowerShell command:

     

    Get-AzSubscription

     

    Login to Azure: Make sure you are logged into the correct Azure account. Use the following command to log in:

     

    Connect-AzAccount

     

    Meanwhile please ensure that subscription is active and not disabled.

     

    I hope the information above is helpful.

    If you have any questions or concerns, please feel free to let us know.

     

    Best regards,

    Jill Zhou

     


    If the Answer is helpful, please click "Accept Answer" and upvote it.

    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.