Open JamesDBartlett3 opened 11 months ago
# Based on [Rui Romano's Set-FabricAuthToken function](https://github.com/RuiRomano/fabricps-pbip/blob/main/FabricPS-PBIP.psm1#L23) $bearerToken = $null $azAccountsModule = (Get-InstalledModule -Name "Az.Accounts" -ErrorAction SilentlyContinue | Out-Null) if($azAccountsModule) { $azSession = (Get-AzAccessToken -ResourceUrl "https://api.fabric.microsoft.com") $bearerToken = $azSession.Token } elseif($servicePrincipalId) { # Auth with Service Principal } else { # Interactive OAuth }