Forum Discussion

Manoune69's avatar
Manoune69
Copper Contributor
Mar 26, 2025

I'm trying to block a number via powershell but it doesn't work.

Hello,

I would like to block a number via powershelle on the tenant, and I was able to find some information on this site :https://learn.microsoft.com/fr-fr/microsoftteams/block-inbound-calls .

I tried to follow it, I first created a number template via this command: New-CsInboundBlockedNumberPattern -Name “BlockNumber1” -Enabled $True -Pattern “^\+?646855502$”

For the moment, I only want to block one number for testing purposes.

Unfortunately, when I run the command to test that blocking is active: 

Test-CsInboundBlockedNumberPattern -PhoneNumber 131*** It always returns false, whereas when I search for my model the enable is in True mode.

So I tried to force enable with this command: Set-CsInboundExemptNumberPattern -Identity “BlocNumber1” -Enabled $True But nothing works. I once managed to get the blocking to work, but since then nothing. Any ideas?

Thank you,

Manon Evrard

2 Replies

  • Lee_S1275's avatar
    Lee_S1275
    Copper Contributor

    Manoune69Did you get this resolved? Also when you had this problem did you use Get-CsTenantBlockedCallingNumbers to confirm your added pattern? I'm having a problem with this, too.  Although Get-CsTenantBlockedCallingNumbers shows my added patterns, Test-CsInboundBlockedNumberPattern returns false (and test calls ring through).  

     

    VasilMichevdoes it take up to 24h for the submitted patterns to be verifiable via Get-CsTenantBlockedCallingNumbers? Or are you saying after confirming added patterns with Get-CsTenantBlockedCallingNumbers, the setting might take 24 hours to actually go into effect and be verificable using Test-CsInboundBlockedNumberPattern?

  • Even if you want to only block a single number, you need to use a pattern/regex. Other than that, make sure to also check the tenant-level setting (Get-CsTenantBlockedCallingNumbers). Lastly, keep in mind that it can take up to 24h for any changes to be reflected.

Resources