Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
mzare
Frequent Visitor

Issue with gateway cmdlet Connect-DataGatewayServiceAccount

I use the DataGateway cmdlet to manage my Data Gateway clusters.

I use Azure Key Vault to store service principal secrets and use Az module to read these secrets. Like below:

 

 

 

Install-Module Az -Confirm:$False -Force
Connect-AzAccount -Identity
$secretClientId = Get-AzKeyVaultSecret -VaultName "KeyVaultName" -Name "data-gateway-svcp-client-id" -AsPlainText;
$secretClientSecret = Get-AzKeyVaultSecret -VaultName "KeyVaultName" -Name "data-gateway-svcp-client-secret" -AsPlainText | ConvertTo-SecureString -AsPlainText -Force;
$secretTenantId = Get-AzKeyVaultSecret -VaultName "KeyVaultName" -Name "global-tenant-id" -AsPlainText;

 

 

After getting the secrets, I use the following command from DataGateway cmdlet to connect to Power BI service.

 

 

Install-Module -Name DataGateway -Confirm:$False -Force
Connect-DataGatewayServiceAccount -ApplicationId $secretClientId -ClientSecret $secretClientSecret  -Tenant $secretTenantId

 

 

This is the error message I get immediately:

 

 

Connect-DataGatewayServiceAccount: Method not found: '!0 Microsoft.Identity.Client.BaseAbstractApplicationBuilder`1.WithLogging(Microsoft.IdentityModel.Abstractions.IIdentityLogger, Boolean)'.

 

 

 

 

 

1 ACCEPTED SOLUTION
mzare
Frequent Visitor

As final update, Microsoft has confirmed that the issue exists and the DataGateway cmdlet is not compatible with Az PowerShell cmdlet. The problem that I have described above does not get resolved by disconnecting Az Account using `Disconnect-AzAccount` or even removing the Az module using `Remove-Module -Name Az`.

Microsoft has responded that they are going to deploy a fix but it'll be after a month. Therefore I'm closing this thread now and give an update in another forum when there is a fix.

View solution in original post

13 REPLIES 13
mzare
Frequent Visitor

As final update, Microsoft has confirmed that the issue exists and the DataGateway cmdlet is not compatible with Az PowerShell cmdlet. The problem that I have described above does not get resolved by disconnecting Az Account using `Disconnect-AzAccount` or even removing the Az module using `Remove-Module -Name Az`.

Microsoft has responded that they are going to deploy a fix but it'll be after a month. Therefore I'm closing this thread now and give an update in another forum when there is a fix.

Anonymous
Not applicable

Thank you Expiscornovus and SaiTejaTalasila 

Hi, @mzare 

If you can't find the corresponding cmdlet, you can import it into Powershell first:

Import-Module -Name DataGateway

Then run the following command:

Connect-DataGatewayServiceAccount -ApplicationId $secretClientId -ClientSecret $secretClientSecret  -Tenant $secretTenantId

Of course, you can use Power Shell ISE to see if this module has been successfully installed on your computer. If it is installed and cannot be called directly, please import it first.

vjianpengmsft_0-1733713519406.png

 

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The issue is not importing the module. The issue only occurs when I run the Az command below first. Otherwise everything works fine independently.

Connect-AzAccount -Identity

 

Hi @mzare,

 

Maybe it is confused about the Az session.

 

Have you tried adding the a line with Disconnect-AzAccount before the Gateway lines to see if that makes a difference?

 

Disconnect-AzAccount
Install-Module -Name DataGateway -Confirm:$False -Force
Connect-DataGatewayServiceAccount -ApplicationId $secretClientId -ClientSecret $secretClientSecret  -Tenant $secretTenantId

 

 



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

Yes, disconnecting doesn't help neither.

mzare
Frequent Visitor

I have tried removing the Az module as well with no success.

SaiTejaTalasila
Super User
Super User

Hi @mzare ,

 

If your requirement is to use the rest API commands and pull the gateway status etc,.. you can refer the below link. I used Microsoft authentication and connecting to power bi service and pulling the details.

How-to-Capture-Power-BI-On-Premises-Gateway-Status-Using-PowerShell-and-Power-Automate


https://www.linkedin.com/pulse/how-to-capture-power-bi-on-premises-gateway-status-u-sai-teja-7jysc?u...

 

I hope it will be helpful.

 

Thanks,

Sai Teja 

Expiscornovus
Super User
Super User

Hi @mzare,

 

Can you run the below after the Install-Module -Name DataGateway line and share the outputs?

 

Just want to double check if you are using PS 7 (and which specific version). And if you are running versions of the module side by side.

 

In other words:

Install-Module -Name DataGateway -Confirm:$False -Force
$PSVersionTable
Get-Module DataGateway -ListAvailable | Select ModuleType,Version,Name

 



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

mzare_0-1733914984406.png

 

To ellaborate the issue further I've run the two scenarios below. The first screenshot is where I do not use Az module to get the service principal secrets.

mzare_1-1733915220400.png

This scenario is where connect to Azure account using `Connect-AzAccount` first and without reading the key vault secrets the `Connect-DataGatewayServiceAccount` command fails to connect to Power BI service.

mzare_2-1733916014150.png

 

Hi @mzare,

 

Can you add the -Verbose parameter at the end of your Connect-DataGatewayServiceAccount line and see if that gives you more information?

 

verbose_parameter.png

 

Btw, what is the Az module version you are using? That would be useful to know to reproduce your issue.



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

Same error message with verbose option added. I'm using latest versions of Az and DataGateway as my solution runs on a vmss that gets redeployed every day with the latest version of the cmdlets.

I've also received this from microsoft support:

According to our documentation, the Connect-DataGatewayServiceAccount cmdlet appears to be incompatible with the Az module, but we are currently investigating internally to find any possibility.

Anonymous
Not applicable

Hi, @mzare 

Thank you for your detailed feedback and the efforts you have made to resolve this issue. I understand how frustrating it can be to encounter this persistent error.
Thank you for your patience and the steps taken to investigate this matter. As mentioned earlier, the Connect-DataGatewayServiceAccount cmdlet does not appear to be compatible with the Az module, and Microsoft Support is actively investigating this issue internally.
You can mark your response as a solution, which can help others facing similar issues and help improve our documentation and support.

Thank you again for your cooperation and understanding.

 

Best regard

Ok, thanks for sharing that feedback from Microsoft Support. That is useful to know.



Happy to help out 🙂

I share #PowerAutomate and #SharePointOnline content on my Blog, Bluesky profile or Youtube Channel

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.