Microsoft365DSC icon indicating copy to clipboard operation
Microsoft365DSC copied to clipboard

[PPTenantIsolationSettings] Exports are ok, Config CHanges fails with invalid tenant identifier provider

Open 1Dimitri opened this issue 11 months ago • 0 comments

Description of the issue

When using PPTenantIsolationSettings, usage of Get-TargetResource is OK, whether the value is Enabled with rules or disabled, When trying to push a configuration, mof file is created but the Set-TargetResource fails with the following error below. The generated payload does include the tenant GUID of the targeted tenant:

Updating with payload:
{
    "properties":  {
                       "tenantId":  "tenantGUID-with-dashes",
                       "allowedTenants":  [

                                          ],
                       "isDisabled":  true
                   }
}

Permissions check: The application uses certificate thumbprint has PowerPlatform administrator role and has been added as a PowerApp Management using

# Login interactively with a tenant administrator for Power Platform (human at this stage)
Add-PowerAppsAccount -Endpoint prod -TenantID $tenantId 
# TenantID is Tenant GUID here
# Register a new application, this gives the SPN / client application same permissions as a tenant admin
New-PowerAppManagementApp -ApplicationId $appId
# $appID is the Application Registration Client ID 

Note that the same application can update the other PP* resource w/o issues (such as creating a Policy)

Microsoft 365 DSC Version

1.25.1203.2

Which workloads are affected

Power Platform

The DSC configuration

# Generated with Microsoft365DSC version 1.25.1203.2
# For additional information on how to use Microsoft365DSC, please visit https://aka.ms/M365DSC
param (
)

Configuration M365TenantConfig
{
    param (
    )

    $OrganizationName = $ConfigurationData.NonNodeData.OrganizationName

    Import-DscResource -ModuleName 'Microsoft365DSC' -ModuleVersion '1.25.1203.2'

    Node localhost
    {
        PPTenantIsolationSettings "PPTenantIsolationSettings"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Enabled               = $False;
            IsSingleInstance      = "Yes";
            TenantId              = $OrganizationName;
        }
    }
}

M365TenantConfig -ConfigurationData .\ConfigurationData.psd1

Verbose logs showing the problem

PowerShell DSC resource MSFT_PPTenantIsolationSettings  failed to execute Set-TargetResource functionality with
error message: {"error":{"code":"InvalidTenantId","message":"Invalid tenant identifier
provided.","detailUrlType":"NotSpecified"}}
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : ProviderOperationExecutionFailure
    + PSComputerName        : localhost

Environment Information + PowerShell Version

OsName               : Microsoft Windows Server 2022 Datacenter
OsOperatingSystemSKU : DatacenterServerEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 20348.1.amd64fre.fe_release.210507-1500
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

Name                           Value
----                           -----
PSVersion                      5.1.20348.4294
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.20348.4294
CLRVersion                     4.0.30319.42000

1Dimitri avatar Dec 19 '25 09:12 1Dimitri