You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attempting to create a new CA policy that requires reauthentication with MFA for every login. Expected behavior is that it will create the policy without errors.
Actual Behavior
╷
│ Error: Could not create conditional access policy
│
│ with azuread_conditional_access_policy.mfa_always_required,
│ on ca_rules_always_mfa.tf line 1, in resource "azuread_conditional_access_policy" "mfa_always_required":
│ 1: resource "azuread_conditional_access_policy" "mfa_always_required" {
│
│ ConditionalAccessPoliciesClient.BaseClient.Post(): unexpected status 400
│ with OData error: BadRequest: 1038: The policy you are trying to create or
│ update contains preview features. Use the Beta endpoint to create or update
│ this policy.
The issue appears to be with the sign_in_frequency_interval = "everyTime", as removing that and using the below session_controls block causes it to create successfully
Hi @garretth9, thanks for reporting this issue. I have been able to reproduce this error and spotted a bug in the provider that could be causing this. However, after reworking the request to look like it should, I was still getting the same error.
I could not immediately see another cause for the problem, so I went to the Portal and discovered that it is using the beta (non-production) API for Conditional Access - at least in the case of setting signInFrequencyInterval: "everyTime". Once I amended the (fixed-up) request to use the beta API, it worked perfectly.
I'll open a PR to fix the incorrect logic around session controls, but we will need to figure out what is happening with the stable API before we could merge it. We can unfortunately not use the beta API at this time (even partially), as the Conditional Access service permanently marks a policy as beta once you amend it with the beta API, making it impossible to use the stable API to manage it.
Community Note
Terraform (and AzureAD Provider) Version
Terraform v1.5.7
on darwin_arm64
Affected Resource(s)
azuread_conditional_access_policy
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
Attempting to create a new CA policy that requires reauthentication with MFA for every login. Expected behavior is that it will create the policy without errors.
Actual Behavior
The issue appears to be with the
sign_in_frequency_interval = "everyTime"
, as removing that and using the below session_controls block causes it to create successfullySteps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: