Unauthorized issue - FabricAdminTenantSettings
Hello Everyone!
I am having an issue with exporting FabricAdminTenantSettings, because of a 401 Unauthorized issue. I cannot find any descriptions or documentation that the permissions are required.
Can anyone help with that, please?
Thank you!
"# Getting application information for Application + Secret authentication $ApplicationId = '****' $ApplicationSecret = '' $TenantId = ''
Exporting resources using application
Export-M365DSCConfiguration -Components @("FabricAdminTenantSettings") -ApplicationId $ApplicationId -CertificateThumbprint $ApplicationSecret -TenantId $TenantId
Error:
[2025/08/11 02:57:44]
{InvalidOperation}
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()
"Error during Export:"
at Invoke-M365DSCFabricWebRequest, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\WorkloadHelpers\M365DSCFabricHelper.psm1: line 23
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\DSCResources\MSFT_FabricAdminTenantSettings\MSFT_FabricAdminTenantSettings.psm1: line 1999
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCReverse.psm1: line 680
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCUtil.psm1: line 1581
at
@gaborenok You can follow the blog from @NikCharlebois here: https://nik-charlebois.com/blog/posts/2024/authenticating-to-fabric/index.html The information will be included soon in the M365DSC documentation, a PR is currently pending.
@FabienTschanz thank you for the helpful and fast response! I will keep you posted about the progress!
Hello!
Do you have any ideas, maybe on this one?
I am trying to export O365OrgSettings
Additionally, I added the permission about 1 hour ago, and I am still receiving unauthorized access on Fabric. Any ideas?
Getting application information for Application + Secret authentication
$ApplicationId = '' $ApplicationSecret = '' $TenantId = '****'
Exporting resources using application
Export-M365DSCConfiguration -Components @("O365OrgSettings") -ApplicationId $ApplicationId -CertificateThumbprint $ApplicationSecret -TenantId $TenantId
ERROR:
[2025/08/11 04:58:42]
{NotSpecified}
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Graph.Authentication.Core, Version=2.29.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
at Microsoft.Graph.PowerShell.Module.1 getEventData, Func4 signal, InvocationInfo invocationInfo)
at Microsoft.Graph.PowerShell.Module.1 getEventData, Func4 signal, InvocationInfo invocationInfo)
at Microsoft.Graph.PowerShell.Module.
WRN: Assembly binding logging is turned OFF. To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There is some performance penalty associated with assembly bind failure logging. To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. <---
"Error retrieving data:"
at Get-MgServicePrincipal
[2025/08/11 04:58:42]
{InvalidOperation}
System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess)
at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
at System.Management.Automation.CommandProcessorBase.Complete()
"Error during Export:"
at Get-M365DSCExportContentForResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCUtil.psm1: line 4021
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\DSCResources\MSFT_O365OrgSettings\MSFT_O365OrgSettings.psm1: line 1051
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCReverse.psm1: line 680
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCUtil.psm1: line 1581
at
Thank you again!
I assume this happens with multiple resources, also for some in the AAD workload like AADApplication or AADServicePrincipal, correct? It seems like you have multiple versions of the Microsoft Graph SDK installed (most like Microsoft.Graph.Authentication). Please uninstall the version 2.29.1 and try again or run Update-M365DSCModule to clean them up automatically.
Thank you! All issues resolved, you can close this ticket!
Hello, sorry for the inconvenience, but I encountered another (I think permission) issue with SPOSite
I only need read permissions, and I added these:
Application permissions Read Sites.FullControl.All
Export-M365DSCConfiguration -Components @("SPOSite") -ApplicationId $ApplicationId -CertificateThumbprint $ApplicationSecret -TenantId $TenantId
Error:
[2025/08/12 04:27:42]
{WriteError}
Microsoft.SharePoint.Client.ServerUnauthorizedAccessException: Attempted to perform an unauthorized operation.
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)
at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse()
at Microsoft.SharePoint.Client.ClientRequest.
Sorry, I was using only graph permissions, not SharePoint permissions. Solved! Thank you!
Hello, I have another issue. Sorry for not opening another ticket; if it is required, please let me know.
When exporting SCDLPCompliancePolicy with a certificate, I am running into this issue. I have the latest DSC version, and all the dependencies are up to date.
Thanks!
Export-M365DSCConfiguration -Components @("SCDLPCompliancePolicy") -ApplicationId $ApplicationId -CertificateThumbprint $ApplicationSecret -TenantId $TenantId
Error:
[2025/08/12 06:01:02]
{ObjectNotFound}
System.Management.Automation.CommandNotFoundException: The term 'Get-DLPCompliancePolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
"Error during Export:"
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\DSCResources\MSFT_SCDLPCompliancePolicy\MSFT_SCDLPCompliancePolicy.psm1: line 958
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCReverse.psm1: line 680
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.25.806.1\Modules\M365DSCUtil.psm1: line 1581
at
@gaborenok Please open dedicated new issues for things not related to the original problem. This helps us distinguishing between multiple problems and adressing them separately.
Anyway, the cmdlet Get-DLPCompliancePolicy is only available if you assign the application the role Security Reader (for reading) or Compliance Administrator (for read / write). Additionally, in the Office 365 Exchange Online permission group, you have to assign Exchange.ManageAsApp.
@FabienTschanz thank you for the support! I will open a new issue next time!