Power BI Output Tool 3.1.0
Designer 2021.3.3 +
When following the API Application Setup section for the Microsoft Power BI Output Tool located at "https://help.alteryx.com/20214/designer/microsoft-power-bi-output-tool", I encountered an issue with API permissions and consent and have found a fix that will be helpful to others and could maybe be considered for inclusion in a future release?
Background:
When you set up a Power BI Output component in Alteryx Designer, it needs to set up an app registration in Azure to handle the permissions. If you use the "Sign in via Internet Browser" authentication method, it creates one of these app registrations for you with built-in settings, as long as you are running Alteryx as a user that has enough permissions to Azure to be able to consent to creating the app and giving it the API permissions it needs.
In an organization with a decent Azure footprint, that workflow will likely be discouraged, as your Azure admins are likely not the users running Alteryx designer themselves and having them shadow you on your PC and input their credentials at an admin consent prompt is likely not best practice. So on the above mention Alteryx Power BI Output Tool page instructions are provided on how to do your own app registration in Azure and what permissions need to be granted. An Azure admin can then take these instructions, create the Azure App Registration with the appropriate API Permissions, CONSENT on behalf of the organization that these API permissions are appropriate, and then all Alteryx users should be able to use the output tool through the app.
The issue I ran into is that even if consent was already granted to the Azure app registration, when trying to connect and authenticate the Power BI output tool an admin consent prompt would still be presented. I tracked this down to an additional "Group.Read.All" permission that the tool was requesting. Because it requested an additional permission, it was requiring additional consent for that new permission to be added. "Group.Read.All" is a legacy permission of the Power BI API that no longer exists. It cannot be "granted" ahead of time when creating an app registration in the Azure Portal. Obviously an issue.
So I dug into the Power BI Output Tool code to see what was going on. There were a couple of issues I found.
The first is in the "app.0583c26040a9777c5c0f.chunk.js" file. This can be found in the "PowerBI_v3.1.0" folder of the installer, or if you are testing out a fix on a system with the tool already installed it can be found either in the global Alteryx install location "C:\ProgramData\Alteryx\Tools\PowerBI_v3.1.0" or if you only installed for your own user it could be in the same subfolders off of the root Alteryx directory at "C:\Users\[Your User ID]\AppData\Roaming\Alteryx".
The last line in the file "app.0583c26040a9777c5c0f.chunk.js" (it's a very long line) contains several references to the deprecated API permission. You can search for and delete any references to "https://analysis.windows.net/powerbi/api/Group.Read.All \n" or to "https://analysis.windows.net/powerbi/api/Group.Read.All". Save the file after these changes (make a backup of the original first of course just in case), restart Alteryx designer, try to connect to your Azure Power BI App, and VOILA, it is now connecting successfully!
You can prepare your workflow now, but if you try to run it, it will generate an error. This is because there is one additional python component in the Power BI Output tool that also needs to be modified.
If you are looking to update the installer look for the file "power_bi-0.0.1+build.922079-py3-none-any.whl" within the ""PowerBI_v3.1.0\Wheels" folder. Within this whl archive look for the "constants.py" file in the "power_bi\power_bi_output\constants" folder. If you are looking to test this fix on an already installed system, the wheels directory where the whl archive is located can be found at "C:\ProgramData\Alteryx\Tools\PowerBI_v3.1.0\wheels". But if you change the constants.py file in there it won't change anything because the whl file has already been installed to your tool's virtual python environment. So for a quick edit test, you could alter the "constants.py" file at it's installed location similar to "C:\ProgramData\Alteryx\Tools\PowerBI_v3.1.0_venv\Lib\site-packages\power_bi\power_bi_output\constants".
This "constants.py" file has a single "https://analysis.windows.net/powerbi/api/Group.Read.All" entry that should be searched for and deleted.
Once these changes have been applied to both the "app.0583c26040a9777c5c0f.chunk.js" and the "constants.py" files of removing the deprecated "Group.Read.All" scope API permissions, the Power BI Output tool will be able to both authenticate with and run successfully in a workflow with the original Azure app registration consents you followed in the howto document.
Hopefully this helps out some of you out there with a similar issue, and hopefully Alteryx will review this and consider implementing the fixes in a future release of the Power BI Output Tool.