Forum Discussion
Can we block a Microsoft 1st party App Via powershell command
We are planning to enable our app in GCCH & by default it's in blocked state untill the admin allows it, This is done via the Manage apps in Teams admin center. This was applicable till general ring & GCC but in GCCH / DOD we don't have the provision of Managed Apps section. The other way to default block an app is blocking an app explicitly in Permission policy. Wanted to know if there is a powershell command to execute the above.
- Varun_GhildiyalBrass Contributor
Yes, you can use the New-CsTeamsMessagingPolicy cmdlet in PowerShell to create a messaging policy that blocks a specific app by default. Here's an example command to create a policy that blocks the "MyApp" app:
New-CsTeamsMessagingPolicy -Identity BlockMyApp -AllowUserApps $false -BlockedApplications @{Add="MyApp"}
This command creates a new messaging policy named "BlockMyApp" that blocks the "MyApp" app. The AllowUserApps parameter is set to $false to prevent users from installing apps themselves. The BlockedApplications parameter is used to specify the app to block.
Once the policy is created, you can assign it to users or groups using the Grant-CsTeamsMessagingPolicy cmdlet. Here's an example command to assign the "BlockMyApp" policy to a specific user:
Grant-CsTeamsMessagingPolicy -Identity email address removed for privacy reasons -PolicyName BlockMyApp
This command assigns the "BlockMyApp" policy to the user with the SIP address
email address removed for privacy reasons