I have seen similar behaviours before but I thought I would share yet another example.
I have been working with a client to programmatically update their users' MFA phone numbers when a user's telephoneNumber (Entra BusinessPhones) property gets set or updated.
The cmdlets in use are:
New-MgUserAuthenticationPhoneMethod
Update-MgUserAuthenticationPhoneMethod
We are using an AR Automation Workflow that fires a script Activity to run the code.
The curious thing we discovered is that in spite of the fact that we have:
1) The cmdlets wrapped in a Try/Catch and,
2) Within that Try/Catch, we call out $ErrorActionPreference = 'Stop',
...certain error conditions are not trapped.
Specifically, by testing the code outside of Active Roles, we determined that the Msft tenant performs validation on the area code portion of the phone number being sent. If the number fails the area code validation, an error is generated saying that though the phone number format is correct, the number itself is not valid.
Frustratingly, this error is not trapped by the Try/Catch when Active Roles executes the code so we cannot even report that it is occurring.
We have tested running the script as a workflow script Activity and as an AR Scheduled Task script with the same results.
- Products
- Solutions
- Resources
- Trials
- Support
- Partners
- Communities