Collect user information

Before performing any additional actions, you’ll need to store your user info as an environment variable that you can use in subsequent steps.

We already collected your subscription information as part of the preparing your subscription instructions. Make sure you’ve completed this process and and any other installation steps are complete before proceeding.

Step-by-step guidance

We’ll be using Bash commands to complete this lab. You can use any compatible command-line environment, such as the Windows Subsystem for Linux, Git Bash, or the Visual Studio Code Bash terminal. To avoid potential errors, do not run these commands in a PowerShell session.

  1. Collect your user info, and then store it for future use.
    • Store your username in an environment variable:
    export USER_NAME=$(az account show --query user.name --output tsv)
    echo $USER_NAME
    
    • Retrieve the user object ID:
    az ad signed-in-user show --query id --output tsv
    

    If you receive an error, such as “AADSTS530003: Your device is required to be managed to access this resource,” use one of the following options to manually collect the user object ID:

    • If you’re using a device managed by your organization, open a command-line environment and run the command az ad signed-in-user show --query id --output tsv.

    • Otherwise, in the Azure portal, open Microsoft Entra ID. In the Search box of the Overview page, enter the username that you just collected. In the search results, select the user and then locate the user Object ID.

    • After you get your user object ID, store it as an environment variable for later use:
     export AAD_USER_ID=<user-object-id>