locked
PowerShell or API REST for adding or deleting a PowerBI license ? RRS feed

  • Question

  • Hi everyone,

    In O365, there are PowerBI licenses. And I want to create a tool which will attribute PowerBI License to an user or delete one from the user.

    So can i use PowerShell or API Rest to do it ? If yes, could you please show me how can i do it ?

    Thanks in advanced,

    Best regards,

    Cao

    Monday, October 24, 2016 8:38 AM

Answers

  • Hi Cao,

    Yes, you can use PowerShell for adding or deleting a Power BI license.

    You can assign a license to a user using the Set-MsolUserLicense cmdlet with the -AddLicenses parameter. However, before doing so, you must set the user's UsageLocation attribute. This attribute requires a two-letter code representing the user's country. Assuming user John Smith is located in the United States, you can run the following command to set the UsageLocation attribute:

    Set-MsolUser -UserPrincipalName 

      "JohnSmith@<tenant>.onmicrosoft.com" -UsageLocation US

    Afterward, you can use the Set-MsolUserLicense cmdlet with the -AddLicenses parameter to assign the license, like this:

    Set-MsolUserLicense -UserPrincipalName 
      "JohnSmith@<tenant>.onmicrosoft.com" 
      -AddLicenses <tenant>:ENTERPRISEPACK

    You can then check to see the products available to this user with the ServiceStatus attribute:
    userLicenseTest.Licenses[0].ServiceStatus

    In addition, as an administrator, you can choose to enable, or disable, individual user sign ups as part of Azure Active Directory (AAD).

        1.You need to first sign into Azure Active Directory using your Office 365 credential. The first line will prompt you for your credentials. The second line connects to Azure Active Directory.
           $msolcred = get-credential
            connect-msolservice -credential $msolcred
       2.Once you are signed in, you can issue the following command to see what your tenant is currently configured for.
              Get-MsolCompanyInformation | fl AllowAdHocSubscriptions
       3.You can this command to enable ($true) or disable ($false) AllowAdHocSubscriptions.
               Set-MsolCompanySettings -AllowAdHocSubscriptions $true

    For more details, please review this article.

    Best Regards,
    Angelia


    Tuesday, October 25, 2016 10:44 AM

All replies

  • Hi Cao,

    Yes, you can use PowerShell for adding or deleting a Power BI license.

    You can assign a license to a user using the Set-MsolUserLicense cmdlet with the -AddLicenses parameter. However, before doing so, you must set the user's UsageLocation attribute. This attribute requires a two-letter code representing the user's country. Assuming user John Smith is located in the United States, you can run the following command to set the UsageLocation attribute:

    Set-MsolUser -UserPrincipalName 

      "JohnSmith@<tenant>.onmicrosoft.com" -UsageLocation US

    Afterward, you can use the Set-MsolUserLicense cmdlet with the -AddLicenses parameter to assign the license, like this:

    Set-MsolUserLicense -UserPrincipalName 
      "JohnSmith@<tenant>.onmicrosoft.com" 
      -AddLicenses <tenant>:ENTERPRISEPACK

    You can then check to see the products available to this user with the ServiceStatus attribute:
    userLicenseTest.Licenses[0].ServiceStatus

    In addition, as an administrator, you can choose to enable, or disable, individual user sign ups as part of Azure Active Directory (AAD).

        1.You need to first sign into Azure Active Directory using your Office 365 credential. The first line will prompt you for your credentials. The second line connects to Azure Active Directory.
           $msolcred = get-credential
            connect-msolservice -credential $msolcred
       2.Once you are signed in, you can issue the following command to see what your tenant is currently configured for.
              Get-MsolCompanyInformation | fl AllowAdHocSubscriptions
       3.You can this command to enable ($true) or disable ($false) AllowAdHocSubscriptions.
               Set-MsolCompanySettings -AllowAdHocSubscriptions $true

    For more details, please review this article.

    Best Regards,
    Angelia


    Tuesday, October 25, 2016 10:44 AM
  • Hi Angelia,

    Thank you very much,

    Best regards,

    Cao

    Friday, October 28, 2016 8:57 AM
  • Hi Angelia,

    I have an another question, can i gererate an token in O365 to do this action ?

    Thanks in advanced,

    Best regards,

    Cao

    Friday, October 28, 2016 9:03 AM
  • Hi Cao,

    Sorry for delay response, you can post a new post to 365 forum to get professional support. Thank you very much.

    Best Regards,
    Angelia
    Monday, October 31, 2016 2:27 AM
  • Hi Angelia,

    Ok, thank you very much,

    Best Regards,

    Cao

    Wednesday, November 2, 2016 9:06 PM
  • Hi Cao,

    You are welcome.

    Best Regars,
    Angelia
    Thursday, November 3, 2016 1:07 AM