Microsoft365DSC
Microsoft365DSC copied to clipboard
MSFT_AADAuthenticationMethodPolicy - Could not find an Azure AD Authentication Method Policy with DisplayName {Authentication Methods Policy}
Description of the issue
When trying to import the default authentication method policy with the settings for the registration campaign and the general settings in authentication methods I get an policy not found when there aren't any changes. If I adjust a setting it can find the policy just fine.
Microsoft 365 DSC Version
V1.24.117.1
Which workloads are affected
Azure Active Directory
The DSC configuration
AADAuthenticationMethodPolicy "AADAuthenticationMethodPolicy-Authentication Methods Policy"
{
ApplicationId = $ConfigurationData.NonNodeData.ApplicationId;
CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
Description = "The tenant-wide policy that controls which authentication methods are allowed in the tenant, authentication method registration requirements, and self-service password reset settings";
DisplayName = "Authentication Methods Policy";
Ensure = "Present";
Id = "authenticationMethodsPolicy";
PolicyVersion = "1.5";
RegistrationEnforcement = MSFT_MicrosoftGraphregistrationEnforcement{
AuthenticationMethodsRegistrationCampaign = MSFT_MicrosoftGraphAuthenticationMethodsRegistrationCampaign{
SnoozeDurationInDays = 1
IncludeTargets = @(
MSFT_MicrosoftGraphAuthenticationMethodsRegistrationCampaignIncludeTarget{
TargetedAuthenticationMethod = 'microsoftAuthenticator'
TargetType = 'group'
Id = 'all_users'
}
)
State = 'disabled'
}
};
SystemCredentialPreferences = MSFT_MicrosoftGraphsystemCredentialPreferences{
IncludeTargets = @(
MSFT_AADAuthenticationMethodPolicyIncludeTarget{
Id = '55d0e756-7157-44fd-ba36-b32c5108e68b'
TargetType = 'group'
}
)
State = 'enabled'
};
TenantId = $OrganizationName;
}
Verbose logs showing the problem
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] [CmdletEndProcessing]: - Get-MgBetaPolicyAuthenticationMethodPolicy end processing.
VERBOSE: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] Could not find an Azure AD Authentication Method Policy with Id
{authenticationMethodsPolicy}
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] [CmdletBeginProcessing]: - Get-MgBetaPolicyAuthenticationMethodPolicy begin processing
with parameterSet 'Get'.
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] [Authentication]: - AuthType: 'AppOnly', TokenCredentialType: 'ClientCertificate',
ContextScope: 'Process', AppName: 'Microsoft365DSC-Import'.
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] [Authentication]: - Scopes: [Policy.ReadWrite.ConditionalAccess, TeamsTab.Read.All,
Channel.Delete.All, User.ReadWrite.All, ChannelSettings.Read.All, RoleManagement.Read.Directory, Policy.ReadWrite.ApplicationConfiguration, Application.ReadWrite.All, Group.Read.All, Directory.ReadWrite.All, Group.ReadWrite.All,
Directory.Read.All, User.Read.All, Domain.Read.All, Agreement.Read.All, Tasks.Read.All, DeviceManagementServiceConfig.ReadWrite.All, EntitlementManagement.ReadWrite.All, Organization.ReadWrite.All,
DeviceManagementManagedDevices.ReadWrite.All, Organization.Read.All, RoleManagement.ReadWrite.Directory, Tasks.ReadWrite.All, AdministrativeUnit.ReadWrite.All, Policy.Read.All, DeviceManagementConfiguration.ReadWrite.All,
Application.Read.All, Policy.ReadWrite.Authorization, DeviceManagementApps.ReadWrite.All, DeviceManagementRBAC.ReadWrite.All].
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] ============================ HTTP REQUEST ============================
HTTP Method:
GET
Absolute Uri:
https://graph.microsoft.com/beta/policies/authenticationMethodsPolicy
Headers:
FeatureFlag : 00000043
Cache-Control : no-store, no-cache
User-Agent : Mozilla/5.0,(Windows NT 10.0; Microsoft Windows 10.0.19044; nl-NL),PowerShell/5.1.19041.3930
Accept-Encoding : gzip
SdkVersion : graph-powershell-beta/2.11.1
client-request-id : 5c1f2ca4-9f31-4283-a81c-d1222abd4194
Body:
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] ============================ HTTP RESPONSE ============================
Status Code:
InternalServerError
Headers:
Transfer-Encoding : chunked
Vary : Accept-Encoding
Strict-Transport-Security : max-age=31536000
request-id : 6702eb7d-e9e0-4650-97ed-c0f318d4ae38
client-request-id : 5c1f2ca4-9f31-4283-a81c-d1222abd4194
x-ms-ags-diagnostic : {"ServerInfo":{"DataCenter":"West Europe","Slice":"E","Ring":"5","ScaleUnit":"005","RoleInstance":"AM4PEPF00015147"}}
Date : Thu, 25 Jan 2024 12:34:09 GMT
Body:
{
"error": {
"code": "internalServerError",
"message": "Internal error: Value cannot be null.\r\nParameter name: source",
"innerError": {
"message": "Internal error: Value cannot be null.\r\nParameter name: source",
"date": "2024-01-25T12:34:09",
"request-id": "6702eb7d-e9e0-4650-97ed-c0f318d4ae38",
"client-request-id": "5c1f2ca4-9f31-4283-a81c-d1222abd4194"
}
}
}
DEBUG: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] [CmdletEndProcessing]: - Get-MgBetaPolicyAuthenticationMethodPolicy end processing.
VERBOSE: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] Could not find an Azure AD Authentication Method Policy with DisplayName
{Authentication Methods Policy}
VERBOSE: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] Test-TargetResource returned False
VERBOSE: [LAP70223281]: LCM: [ End Test ] [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] in 21.1240 seconds.
VERBOSE: [LAP70223281]: LCM: [ Start Set ] [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy]
VERBOSE: [LAP70223281]: [[AADAuthenticationMethodPolicy]AADAuthenticationMethodPolicy-Authentication Methods Policy] Importing the module MSFT_AADAuthenticationMethodPolicy in force mode.
Environment Information + PowerShell Version
OsName : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture : 64 bits
WindowsVersion : 2009
WindowsBuildLabEx : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage : nl-NL
OsMuiLanguages : {nl-NL}
Unable to reproduce the issue.