How can I create Firewall rules for Universal Windows Platform (UWP) apps?

Let's say I want to create a firewall rule for a Universal Windows Platform (UWP) app (Ex: Microsoft News, Netflix, etc.).
How can I do that? (Command prompt / Powershell / Windows Defender Firewall with Advanced Security)

I can create a Firewall rule using the application path. However, I'm not sure whether it's the recommended way to create rules for UWP apps.


Solution 1:

UWP apps are local containerized apps that only come from the Windows Store or your internal enterprise store. Which are vetted apps. If you don't want the apps, then institute a DSC policy or App restriction policy to prevent them from being installed/used

How to Use AppLocker to Block Microsoft Store Apps from Running in Windows 10

Solution 2:

From the examination of such rules in the Windows Defender Firewall with Advanced Security, it seems that the rules are defined using the package SID.

Using the Windows Defender app, this requires creating a Custom rule, then next to "Services" pressing the Customize button, then using the option "Apply to app package with this app package sid".

If you are into programming see the post
How to set up a rule for a Store app using the Windows Firewall API?

Solution 3:

I'm sorry guys but looks like that in some cases it's better to we have less knowledge...

Personally I'm a total noob in coding, but I really wanted to block some UWP apps in my PC.

This webpage, is the "END" of road for everyone who google this thing: "How to block UWP apps in Firewall"

With a lot of respects, you guys really make this issue harder than it needs to be...

NO CODING IS NEEDED AT ALL

You can simply block an UWP app in Firewall just like any other traditional Desktop software.

Your problem is that you don't look for the easiest way, you just look for the most advanced solution...

However, as I mentioned above, blocking internet connection for an UWP app is just like a traditional Desktop software.

EASY SOLUTION:

Type "advanced security" in Windows 8/10 search then select "Windows Defender Firewall with Advanced Security". In the newly opened window and in the left panel, go to "Inbound Rules" then in the right panel, select "New Rule..." then tap "Next" when "Program" is selected. Then click on "Browse..." and go to this address:

*C:\Program Files\WindowsApps*

Now find your app's name and enter its folder then select the file with "Application" type. I do agree with anyone who say that finding the right file, is not that easy. But not that hard too... You'll be able to find the right "Application" type file just in a few seconds. As an example, the folder name for the "Google" app is this:

GoogleInc.GoogleSearch_2.1.19.0_x64__yfg5n0ztvskxp

And the name of its app "Application" file type is this:

GoogleSearchUniversal

However, after choosing the correct "Application" file type click on "Open" for it. Then tap "Next" and then choose "Block the connection" then "Next" then marking all types of connections then "Next" then call it and "Finish" and boom! lol...

Just like a traditional Desktop software.

You see? Not a big deal...

As a conclusion, let's don't make it harder than it needs to be. Leave your coding knowledge behind and look for an EASY method instead...