Forum Discussion

shatvani's avatar
shatvani
Copper Contributor
Sep 29, 2023
Solved

PowerShell subscription

Hi,

I am sorry to ask so newbie question but I start studying Azure just now.

I bought a course and I got tuck at the first lesson.

I want to open PowerShell window in Azure but it tells me this:

No valid subscriptions found
You need an Azure subscription to use Azure cloud Shell.

It is interesting because the company which I work at, has Office 365, Azure AD, etc. subscriptions.
I do not know whether this subscription is free or we have to pay for it later.
Can someone help me, please?

  • Hi shatvani,

    There are a few possible reasons why you might be getting this message, even though your company has Azure AD subscriptions:

    • You are not logged in to the correct Azure Active Directory tenant.
    • Your user account does not have the necessary permissions to access Azure Cloud Shell.
    • Your company has disabled Azure Cloud Shell for your subscription.

    To check which Azure Active Directory tenant you are logged in to, run the following PowerShell command:

     

    Get-AzContext

     

     

    This will return the name of the tenant that is currently associated with your PowerShell session.

    If you are not logged in to the correct tenant, you can switch tenants using the Set-AzContext cmdlet.

    To check if your user account has the necessary permissions to access Azure Cloud Shell, run the following PowerShell command:

     

    Get-AzRoleAssignment -PrincipalName <your_user_account_name>

     

     

    This will return a list of all the roles that are assigned to your user account. If you do not see the Azure Cloud Shell Contributor role in the list, then you will need to contact your Azure administrator to have it assigned to you.

    If you have checked both of the above and you are still getting the message No valid subscriptions found, then it is likely that your company has disabled Azure Cloud Shell for your subscription. In this case, you will need to contact your Azure administrator to have it enabled.

    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic
    (LinkedIn)

3 Replies

  • LeonPavesic's avatar
    LeonPavesic
    Silver Contributor

    Hi shatvani,

    There are a few possible reasons why you might be getting this message, even though your company has Azure AD subscriptions:

    • You are not logged in to the correct Azure Active Directory tenant.
    • Your user account does not have the necessary permissions to access Azure Cloud Shell.
    • Your company has disabled Azure Cloud Shell for your subscription.

    To check which Azure Active Directory tenant you are logged in to, run the following PowerShell command:

     

    Get-AzContext

     

     

    This will return the name of the tenant that is currently associated with your PowerShell session.

    If you are not logged in to the correct tenant, you can switch tenants using the Set-AzContext cmdlet.

    To check if your user account has the necessary permissions to access Azure Cloud Shell, run the following PowerShell command:

     

    Get-AzRoleAssignment -PrincipalName <your_user_account_name>

     

     

    This will return a list of all the roles that are assigned to your user account. If you do not see the Azure Cloud Shell Contributor role in the list, then you will need to contact your Azure administrator to have it assigned to you.

    If you have checked both of the above and you are still getting the message No valid subscriptions found, then it is likely that your company has disabled Azure Cloud Shell for your subscription. In this case, you will need to contact your Azure administrator to have it enabled.

    Please click Mark as Best Response & Like if my post helped you to solve your issue.
    This will help others to find the correct solution easily. It also closes the item.


    If the post was useful in other ways, please consider giving it Like.


    Kindest regards,


    Leon Pavesic
    (LinkedIn)

    • shatvani's avatar
      shatvani
      Copper Contributor
      Hi LeonPavesic,
      Get-AzContext gives back my account without any subscriptions.
      Get-AzRoleAssignment -PrincipalName <your_user_account_name> gives me a 'Get-AzRoleAssignment : A parameter cannot be found that matches parameter name 'PrincipalName'.' error.
      • LeonPavesic's avatar
        LeonPavesic
        Silver Contributor

        Hi shatvani ,

        the error message "Get-AzRoleAssignment : A parameter cannot be found that matches parameter name 'PrincipalName'." indicates that you are using an older version of the Azure PowerShell module.

        To fix this, please update your Azure PowerShell module to the latest version. You can do this by running the following PowerShell command:

         

         

        Update-Module -Name AzOnce you have updated the Azure PowerShell module, you should be able to run the Get-AzRoleAssignment command without any errors.<br /><br />

         

        If you are still getting the error message "No valid subscriptions found" after updating your Azure PowerShell module, then it is likely that your user account does not have any subscriptions associated with it.

        To troubleshoot this issue, you can try the following:

        1. Make sure that you are logged in to the correct Azure Active Directory tenant. You can check this by running the following PowerShell command:
           

         

        Get-AzContextIf you are not logged in to the correct tenant, you can switch tenants using the Set-AzContext cmdlet.<br /><br />

         

        1. Check if your user account has the necessary permissions to access Azure Cloud Shell. You can do this by running the following PowerShell command:

         

        Get-AzRoleAssignment -ObjectId <your_user_account_object_id>​If you do not see the Azure Cloud Shell Contributor role in the list, then you will need to contact your administrator to have it assigned to you in IAM.<br /><br />

         

        If you have tried both of the above steps and you are still getting the error message "No valid subscriptions found", then it is likely that your company has disabled Azure Cloud Shell for your subscription. In this case, you will need to contact your administrator to have it enabled.

        Please click Mark as Best Response & Like if my post helped you to solve your issue.
        This will help others to find the correct solution easily. It also closes the item.


        If the post was useful in other ways, please consider giving it Like.


        Kindest regards,


        Leon Pavesic
        (LinkedIn)

         

         

Resources