Struggling with using SPFx on SharePoint 2016? Let me help!

This article is contributed. See the original author and article here.

SharePoint has a lot of great out-of-the-box capabilities, but sometimes you need to take it a step further.  For example, you need a custom user interface to improve productivity.


 


The SharePoint Framework (aka SPFx) is a great way to customize SharePoint and Teams. There have been various ways to customize SharePoint in the past, but SPFx is the recommended option.  This is especially true for SharePoint Online, but also for more recent versions of SharePoint on-prem.  What I like about SPFx – beyond the fact that it lets you customize SharePoint – is that there are several web controls that are ready to use and require very little effort to incorporate into your customizations.  Not only do these components function well, they also fit the look and feel of SharePoint today.


 


SPFx is supported with SharePoint 2019 and SharePoint 2016 (with feature pack 2), but there are limitations to both.  This post focuses on the limitations with SharePoint 2016 which are more restrictive than SharePoint 2019.  In addition, some of the details I provide will be specific to my development environment which runs on Windows 10.


 


Confused Yet?


I think part of the confusion on developing with SPFx on SP2016 is because SP2016 hasn’t changed in years, but SPFx is constantly changing.  The documentation on what to use with SP2016 is pretty old and hasn’t kept up. For example, to get started with SPFx on SharePoint 2016, this seems like the logical place: SharePoint Framework development with SharePoint Server 2016 Feature Pack 2.  The web page was updated within the last month of when I wrote this post.  However, the video shown is from 2017.  In the video, Vesa recommends version 1.0.2 as the SPFx version and the post mentions version 1.1.0.  What worked for me (more details below) was version 1.9.1.


 


What made this more confusing to me is that there were other blog posts indicating you can use any version of key dependencies:



That last post mentions version 1.9.1 of @microsoft/generator-sharepoint, which is what I used.  But it was the latest at the time of that post.  I had trouble with later versions, which it recommended (but did caveat that they may not work).  Your mileage may vary.


 


Multiple Paths Forward and Limitations


I definitely recommend checking out the links above to see if they work for you.  If they don’t, then hopefully the steps I outline below will work.  It’s hard to sound too confident because others sounded confident in the posts above.  They clearly worked for them, but didn’t work for me.  Maybe it was user error, but who knows what else will change going forward that may somehow cause issues.


 


Whenever deciding on what versions to use, a good resource to use is: SPFx Compatibility Matrix.


 


Depending on the path you take may change your limitations, but here are some I know of:



  • You can only create web parts, not extensions.

  • You cannot bundle your assets with the package (sppkg) file.  You must host your assets (manifest JSON and JavaScript files) in a SharePoint document library, Azure, or somewhere else.  I discuss how to do this further below.

  • Some Fluent UI Controls won’t work.  Based on the path I took (described below), There was no ComboBox, no PeoplePicker, and the Dropdown did not allow multi-select.  There are probably several other controls that aren’t available, but I didn’t need them, so I didn’t check.  Of those that are available, the documentation has properties/capabilities that are newer than what I was able to use.  Sometimes I went to the old Office UI Fabric React documentation, but even then that was sometimes too new for what I was using.

  • I was unable to use React Hooks and had to use the React component class.  React hooks were introduced in React 16.8.  I’m using React 15.4.2.  This may be why some newer Fluent UI controls cannot be used.


Prerequisites


Regardless of the approach you take, everyone appears to agree on the prerequisites:



  • SharePoint Server 2016

  • Feature Pack 2 Installed


To check to see if Feature Pack 2 is installed, I went to Feature Pack 2 Required to Install ShortPoint SPFx on SharePoint 2016 On-premise.  There may be better articles out there.  Two key parts of this that helped me were:



  • If you don’t see “Manage Patch Status”, look for “Check Production and Patch Installation Status”.

  • For “Microsoft SharePoint Foundation 2016 Core”, you are looking to see if there is an item with a version number >= 16.0.4744.1000 with a status of Installed.  If not, you’ll need to install Feature Pack 2 as the link above describes.


Node v8.17.0 (Recommended: Install NVM for Windows)


If you’re developing SPFx for SharePoint Online or SharePoint 2019 in the same development environment, you’ll need to maintain multiple versions of node.  A great way to do that is with nvm-windows.


 


After installing nvm-windows, you need to install and use node version 8.17.0: 


 


 

nvm install 8.17.0
nvm use 8.17.0

 


 


 


Then you can check the active version of node with: 


 


 

nvm list

 


 


 


Note: if you don’t want to install nvm and just want to install node, you can get version 8.17.0 from here: Index of /dist/latest-v8.x/ (nodejs.org).  If you have installed node directly, you can check the version using: 


 


 

node -v

 


 


Install NPM Packages


Before installing other packages, I wanted to check on the version of npm.  I did this with: 


 


 


 

npm -v
npm list g --depth 0

 


 


 


Both v3.10.10 and v6.13.4 of npm worked for me.


 


Then I installed a specific version of gulp, yeoman generator, and generator-sharepoint: 


 


 

npm install -g gulp@3.9.1
npm install -g yo@1.8.5
npm install -g @microsoft/generator-sharepoint@1.9.1

 


 


 


Installing gulp may not be required, but it helps to have gulp at the ready from the command line.  Otherwise you may need to play with the path or add scripts to package.json to call gulp for you while you do something like: npm run <my-script>


 


Regarding v1.9.1 of generator-sharepoint, it could be that a later version works for you.  This worked for me and v1.12.0 did not work for me.  Maybe something in between is a better choice.


 


Generate Your Project


This is old hat for many, but for those not used to it, I’ll spell out some details…


 


Create a directory for your web part project and cd into that directory.  This could be the name of your solution or even just “WebParts”.  Think about how you want to organize your code.  Do you want a separate solution per web part or do you want to be able to have several web parts within one project in the future.  The former makes it so a change to one web part does not require all to be re-deployed.  The latter allows the web parts to have shared components.  You generate the project with:


 


 

yo @microsoft/sharepoint

 


 


 


Then you answer several questions.  Here are some example answers:


































What is your solution name?


Hello World SPFx 2016


Which baseline packages do you want to target for your component(s)?


SharePoint 2016 onwards, including 2019 and SharePoint Online


Where do you want to place the files?


Use current folder


Which type of client-side component to create?


WebPart


What is your Web part (on-prem) name?


HelloWorld


What is your Web part (on-prem) description?


A sample web part


Which framework would you like to use?


React


 


Test Your Project in the SharePoint Workbench


Even though you haven’t done much yet, your project should run.  To run the workbench you would normally do a “gulp serve”, but since we’re stuck in version 8 of node, we need to Run gulp serve with ‘NODE_NO_HTTP2=1’ when using SPFx on node v8:


 


 

set NODE_NO_HTTP2=1 && gulp serve

 


 


Note that the command above looks a little different when run on a Mac.


 


From the resulting web page that pops up, you should be able to see your web part and edit the web part property.


 


Minor Cleanup


The yeoman generator does a great job, but it does make some assumptions that aren’t ideal.  One is the solution name could be friendlier.  This shows when you are adding the solution to App Catalog (discussed below).  To fix this, go into configpackage-solution.json and change the solution name to be a friendlier name.  You can use spaces instead of dashes and feel free to capitalize the first letter of each word.  You can’t use a period in the solution name, however.


 


 

{
    "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
    "solution": {
        "name": "Hello World SPFx 2016",
        "id": "5d88310e-6651-4dc3-a80a-be165e851e9b",
        "version": "1.0.0.0"
    },
    "paths": {
        "zippedPackage": "solution/hello-world-spfx-2016.sppkg"
    }
}

 


 


 


Consider updating the group that is shown when adding a web part to a page.  By default this is “Other”.  The group name is defined in the web part json file found at srcwebparts<web-part-name><web-part-name>WebPart.manifest.json.  Change “Other” to any name you like.  You don’t need to change the groupId.


 


 

"preconfiguredEntries": [
    {
        "groupId": "5c03119e-3074-46fd-976b-c60198311f70", // Other
        "group": { "default": "Other" },

 


 


 


Dev Test / Deploy


If your dev environment has access to the SharePoint 2016 server, you can use the following steps:



  • gulp bundle
    gulp package-solution


  • Create an App Catalog: Manage the App Catalog in SharePoint Server.  Note that SharePoint Online allows apps to be uploaded to just a site collection, but in SP2016 you must have an App Catalog for the entire web application.

  • Upload your package to the app catalog.  Go into your app catalog, choose Upload, and pick the sppkg file from your sharepointsolution folder.  Notice how the trust dialog mentions https://localhost:4321 because this is a dev deploy (further below we do a non-dev deploy with the –ship flag).

  • Click the Deploy button.  Notice that there is no tenant wide deployment of apps like there is in SharePoint Online.

  • Add the App to your site.  Go to the site where you want to deploy your app.  Go to Site Contents > add an app.  Pick the name of your solution and wat for it to be enabled (no longer grayed out).

  • set NODE_NO_HTTP2=1 && gulp serve --nobrowser


  • Add your web part to a page.  Go to Site Contents > Site Pages.  Add a page then go to Insert > Web Part and pick the Other category (or whatever you renamed it to above) to find your web part.

  • Verify that your web part works.


Test a Minor Change


With all of the potential problems around versioning of dependencies, it’s a good idea to take small steps.  Let’s start with a small change…


 


In your editor (you are using VSCode, right?), edit srcwebparts<web-part-name>components<web-part-name>.tsx and make a simple change to the title text and save your changes.  If your terminal is still running “gulp serve” as mentioned above, then you just need to wait a few seconds and refresh your web page from the previous section.  There is no need to re-deploy the sppkg file for simple code changes.


 


Incorporate Office Fabric


The yeoman generator does not have Office Fabric as part of it.  Here we add that and do a small test that uses it:



  • Kill the “gulp serve” in your terminal window (CTRL-C)

  • npm install office-ui-fabric-rect@2.34.2​




    • This is a critical step.  The new Fluent UI will not work – we must use this version.

    • This may be the first time doing an npm install can actually cause other issues.  See the section further below entitled: Check package-lock.json On Every npm install.  It may not happen here – maybe it is just needed for anything else you happen to install.



  • Edit srcwebparts<web-part-name>components<web-part-name>.tsx as follows:

    • Add near the top of the file:

      • import { TextField } from 'office-ui-fabric-react';




    • Add just inside the innermost div (maybe before the anchor tag):

      • <TextField label='Test Office UI Fabric React' />




    • Test the updates:

      • set NODE_NO_HTTP2=1 && gulp serve --nobrowser


      • Refresh your page with the web part on it



    • If the above fails, try a redeploy.  Whenever we do an npm install, I feel that you may need to redeploy your package.  Here are the steps:

      • Update configpackage-solution.json and increment the version (to 1.0.0.1)

      • gulp bundle
        gulp package-solution


      • Upload your sppkg file into your App Catalog and deploy it

      • set NODE_NO_HTTP2=1 && gulp serve --nobrowser


      • Refresh your page with the web part on it






Test a Production (Ship) Build – First Time


So far the only tests we have done above are running from localhost and not running from SharePoint.  To have them run from SharePoint, you need to create package that runs from SharePoint.


 


Since SharePoint 2016 can’t read the assets (manifest and JavaScript files) from with the package, we need to deploy the assets to another location.  This can be any website, but I’ll cover two options: a SharePoint Library or an Azure storage account.  Since you are already using SharePoint, that may be the best option for you.



  • SharePoint Library

    • The files include not only JavaScript, but also a JSON manifest.  By default, SharePoint 2016 does not allow JSON files in a document library.  This article describes how to fix this:  HOW TO ALLOW JSON FILE FORMAT ON SHAREPOINT 2016 ON PREMISE

    • I consider JSON files pretty harmless, but here is a discussion on that you may find useful if you are unsure: Why is upload of JSON files prohibited?

    • The only other part of this is to create a folder in a library somewhere.  You might want to create a folder in the Site Assets library in the site where the web part will reside or in a common site if the web part will be across site collections.  The end users need access to the library, of course.

    • Open configwrite-manifest.json and update the cdnBasePath to point to the folder you created.  For example: 

      {
        "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
        "cdnBasePath": "https://sp2016.mycorp.com/sites/somesite/SiteAssets/helloworld-webpart-assets"
      }​






  • Azure Storage Account

    • First you’ll need to create an Azure storage account.

    • Create a blob container within the storage account.

    • Set the Public Access Level to Public read access for blobs only.

    • It’s not required, but if you like you can create a CDN for the Azure storage account.

    • Open configwrite-manifest.json and update the cdnBasePath to point to the container (or Azure CDN) you created.  For example: 

      {
        "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
        "cdnBasePath": "https://mytestcdn.azureedge.net/helloworld-webpart-assets"
      }​





Your asset deployment location is ready.  Let’s build and package the solution.  We use –ship to indicate that we are running from SharePoint and not localhost:



  • Update configpackage-solution.json to increment your version number

  • gulp bundle --ship


  • Copy tempdeploy folder contents to the appropriate location configured above

  • gulp package-solution --ship


  • Upload your sppkg file into your App Catalog

  • Refresh your page with the web part on it.  There is no need to run gulp serve as this is running completely with SharePoint now. If you get errors, try using dev tools in your browser to see if there are network errors accessing the files from the CDN.

  • Note: to go back to a dev build, you don’t have to change write-manifest.json again (see the next two sections for what to do)


Subsequent Production (Ship) Build Tests


The section above described what to do the first time you deploy everything to SharePoint.  Here are the steps for any other times you deploy to SharePoint:



  • Update configpackage-solution.json to increment your version number

  • Delete all files in your tempdeploy folder

  • gulp bundle --ship


  • Delete all files in your Azure blob container or Site Assets folder

  • Copy tempdeploy folder contents to the appropriate location (SharePoint library or Azure blob container)

  • gulp package-solution --ship


  • Upload your sppkg file into your App Catalog

  • Refresh your page with the web part on it (no need to run gulp serve as this is running totally in SharePoint now).  If you get errors, try using dev tools in your browser to see if there are network errors accessing files from the CDN


Subsequent Dev Tests


For most dev changes, the process is simple.  If you are already running gulp serve and didn’t do a production/ship build recently, the process is as simple as:



  • Make sure you are still running: 

    set NODE_NO_HTTP2=1 && gulp serve --nobrowser​


  • Refresh your web page with the web part on it after saving your changes and waiting a few seconds


If you were just doing a production (ship) build, did an npm install, or otherwise changed package.json, you probably need to do these steps instead:



  • increment your version number in package-solution.json

  • gulp bundle
    gulp package-solution


  • Upload your sppkg file to the App Catalog

  • set NODE_NO_HTTP2=1 && gulp serve --nobrowser


  • Refresh your page with the web part on it


Check package-lock.json On Every npm install


Unfortunately, there is an issue with the SPFx TypeScript version which requires you to do something you aren’t supposed to do: manually update package-lock.json.  The process is described here: Workaround for SPFx TypeScript Version.


 


I got in the habit of searching package-lock.json for “typescript” (with the quotes) every time I did an npm install to change 2.2.2 back to 2.4.2.  You’ll be glad you did.


 


In addition, you don’t want to wait too long to test a production/ship version of your build after doing an npm install.  Make sure you are using version control for your code and review your package-lock.json for changes every time you checkin changes.


 


Don’t Be Tempted to Use a Later Version of Microsoft or PnP


If you look at your package.json file, the dependencies section, might look like this:


 


 

"dependencies": {
    "@microsoft/sp-core-library": "~1.1.0",
    "@microsoft/sp-lodash-subset": "~1.1.0",
    "@microsoft/sp-office-ui-fabric-core": "~1.4.0-0",
    "@microsoft/sp-webpart-base": "~1.1.0",
    "@pnp/common": "^1.1.0",
    "@pnp/logging": "^1.1.0",
    "@pnp/odata": "^1.1.0",
    "@pnp/sp": "^1.1.0",
    "@types/es6-promise": "0.0.33",
    "@types/react": "0.14.46",
    "@types/react-addons-shallow-compare": "0.14.17",
    "@types/react-addons-test-utils": "0.14.15",
    "@types/react-addons-update": "0.14.14",
    "@types/react-dom": "0.14.18",
    "@types/webpack-env": "1.13.1",
    "office-ui-fabric-react": "^2.34.2",
    "react": "15.4.2",
    "react-dom": "15.4.2"
},

 


 


 


You might be tempted, as I was, to maybe bump those @microsoft/sp-* and @pnp/* packages to 1.4.1 or some other version by doing an npm install of them to a specific version.  I highly recommend against this.  If you do, make sure you are prepared to revert both package.json and package-lock.json.  Also test with a production/ship build as you will likely find, as I did, that it works with a dev build, but not a production build.


 


More details can be found here: Duplicate of issue #985: deployed web part says “Manifest not found”, after updating from 1.1.0 to 1.3.4


Note that you might want to remove the “~” and “^” from some of those versions to make sure the version matches exactly (and doesn’t use an approximate equivalent version or compatible with version).


 


If you ever have to revert package.json and package-lock.json, the easiest way to get back where you were after you revert is to delete your node_modules folder, do an npm install, and then fix your package-lock.json as discussed in the previous section.


 


No SharePoint Server Access from Dev?


If this is the case for you, I’d like to say this is not really a problem, but it will be pretty painful.  If possible, I recommend developing where your machine has access to the SharePoint server.  Maybe even a Dev/Test SharePoint server, if there is one.  Otherwise, you may want to use an Azure storage account / CDN to store your assets instead of a SharePoint library, as it may be quicker to transfer them for every minor change you make.  You won’t be able to run gulp serve and run things from localhost.


 


I recommend you check out this blog post for generating a source map for the release build: Easily debug production version of your SharePoint Framework solution.  If you put the source map with the rest of the source (in Azure blob or SharePoint Site Assets) you won’t need to manually add the source map to your browser.


 


TSLint Changes


As you start adding more of your own code, you may start seeing TSLint warnings.  It can be quite annoying as you may miss real warnings, so you want a clean build.  I had trouble configuring TSLint via tsling.json, so I used prettier within VS code and configured it by creating a prettier.config.js file at the root of my project.  Its contents are the following.  The trailingComma and singleQuote values are important to minimize prettier and TSLint from fighting each other.


 


 

module.exports = {
    trailingComma: 'es5',
    tabWidth: 4,
    singleQuote: true,
    printWidth: 120,
};

 


 


 


Even with the above, I was still getting a lot of TSLint errors, so I reviewed TSLint rule flags and had to enact several rules within my code including:



  • Immediately before I exported something where the filename had more than one period in it: 

    /* tslint:disable-next-line:export-name */​


  • Immediately before I used the type “any” for a variable.  This seemed necessary when I couldn’t find a type that PnP was using (maybe I didn’t look hard enough): 

    /* tslint:disable-next-line:no-any */​


  • Immediately before any line that just didn’t fit TSLint’s max line length (I think it is 120, but my configuration is ignored, so I am not sure what it is): 

    /* tslint:disable-next-line:max-line-length */​


  • This problem occurred when prettier insisted on ending an arrow function with a semicolon, but TSLint complained, so I put it right before the closing of the arrow function: 

    /* tslint:disable-next-line:semicolon */​

     




Summary


Well, if you made it this far, I applaud you – and am a little surprised.  I don’t tend to write blog posts that are this long, but I really needed to get this off of my chest.


 


Many companies are still on older versions of SharePoint and the effort to upgrade is sometimes daunting (but ThreeWill can help!)  If you are working with SharePoint 2016 and want to build custom web parts with SPFx I hope the steps above (and the pain I went through) saves you some time.

Windows IoT support lifecycle and upcoming releases

This article is contributed. See the original author and article here.

“Windows has always existed to be a stage for the world’s innovation. It’s been the backbone of global businesses and where scrappy startups became household names. The web was born and grew up on Windows. It’s the place where many of us wrote our first email, played our first PC game, and wrote our first line of code. Windows is the place people go to create, to connect, to learn, and to achieve – a platform over a billion people today rely on.” – Panos Panay


 


We want to use this blog to address questions and comments we have received over the past few days regarding Windows IoT and the commitment around the support lifecycle.


In February we announced that there will be release of Windows 10 Enterprise LTSC and Windows 10 IoT Enterprise LTSC in the second half (H2) of calendar year 2021.  In that announcement we communicated that Windows 10 Client LTSC will change from a 10-year to a 5-year lifecycle, aligning with the changes to the next perpetual version of Office. We also stated that Windows 10 IoT Enterprise will maintain a 10-year support lifecycle.  You can read more about their announcements here.


This has not changed with all the announcements around Windows 11, and we are still scheduled to release a LTSC version of Windows 10 IoT Enterprise in the timeframe specified in that announcement.  We will also release IoT versions of Windows 11 and Windows Server 2022. The first release of Windows 11 IoT Enterprise will have a servicing timeline of 36 months from the month of release as described in our lifecycle documentation. We will announce more information around these releases in the future.


 


The needs of the IoT industry remain unique and for that reason Microsoft developed Windows 10 IoT Enterprise LTSC and the Long Term Servicing Channel of Windows Server, which today is Windows Server 2019. Each of these products will continue to have a 10-year support lifecycle, as documented on our Lifecycle datasheet.


 


We remain committed to the ongoing success of Windows IoT, which is deployed in millions of intelligent edge solutions around the world. Industries including manufacturing, retail, medical equipment and public safety choose Windows IoT to power their edge devices because it is a rich platform to create locked-down, interactive user experiences with natural input, provides world class security and enterprise grade device management, allowing customers and partners to build solutions that are designed to last.


 


 


 


 

Diagnosing Network Isolation Issues

Diagnosing Network Isolation Issues

This article is contributed. See the original author and article here.

Hi all, Will Aftring here from Windows Networking Support.


 


I wanted to chat about how Network Isolation interacts with Universal Windows Platform (UWP) applications and how / why you may want to alter some of these settings in respect to the network and their usage within an Active Directory (AD) integrated domain.


 


What is this?


 


As of Windows 8.1+, modern UWP applications have more granularity with determining the scope of operating system (OS)  resources they have access to.


These configurations are made in the application manifest and applied to the binary during compilation. There are tools available in the OS to help diagnose issues and make small configuration changes.


 


How it works


 


Network Isolation defines network access to the application.


This includes the following:



  • Outbound client-initiated requests


    • The application reaching out to another resource over the network


  • Inbound unsolicited requests


    • A client reaching out to the application unsolicited



 


These network connections are broken down into the following boundaries based on their destination:



  • Home/Work: A local home or work network and other machines considered to be local. In a domain environment this is defined by AD Sites and Subnets.

  • Internet: Any connection that is not a part of Home/Work is considered internet. This includes proxies that would provide access to the internet.


If any traffic generated by that application that is not defined in the manifest, will be dropped by the Windows Filtering Platform (WFP).


 


Network Isolation Group Policies


 


As mentioned above, any endpoint not defined in AD Sites and Subnets is considered to fall within the internet boundary.


However, there are a handful of group policies that allow for the boundaries to be tweaked.


 These group polices are found here:


Computer Configuration -> Administrative Templates -> Network -> Network Isolation


 


WAftring_0-1625249038859.png


 


 For instance, through the group policy outlined below, users can explicitly add intranet proxies to the Home/Work boundry:


 


WAftring_1-1625249038875.png


 


More details about each of the available group policies and examples of specific implementations can be found below.


Isolating Apps on Your Network: Define your Network 


 


Benefits of redefining your AD subnets:


 


WFP defines its filters for sites within AD as concisely as possible. However, due to the nature of how WFP filters define their scope, having many AD subnets can create excessive numbers of WFP filters. As a result of excessive WFP filters, network transmissions may take longer. Additionally, the OS may experience high CPU utilization during the creation of these WFP filters.


A good rule of thumb is with more than 300 AD subnets defined; you may start seeing hits to performance.


A quick way to check the defined AD subnets is with the following PowerShell cmdlet:


 

PS C:> Get-ADReplicationSubnet -Filter "*" | Measure-Object | Select-Object Count

 


If the count of subnets exceeds 300, it is worth investigating redefining your AD subnets or  supernetting some AD subnets in the available group policies. Configuring the supernets in group policy is an easy two-step process.


 


These are the two group policies that control this behavior.


 


WAftring_2-1625249038904.png


 


First would be enabling the subnet definitions as authoritative.


 


WAftring_3-1625249038907.png


 


 


Second, would be grouping the AD subnets into super-nets within Private network ranges for apps.


 


WAftring_4-1625249038913.png


 


 


For example, if you have the AD subnets of 192.168.1.0/24 and 192.168.2.0/24, … 192.168.200.0/24 this could easily be included in a super-net of 192.168.0.0/16 reducing the number of filters into a single range that is defined by a single WFP filter.


 


This reduces the number of WFP filters allowing for a more efficient:


 



  • Creation of WFP filters

  • Processing of inbound and outbound network traffic


 


Windows Firewall Rules per UWP Capability


 


Another feature of UWP applications is that IT administrators have additional options for how they configure the Windows Firewall around these applications.


UWP specific Windows Firewall settings are made available through the local principals option for a firewall rule. Firewall settings for UWP applications can be applied based on a permission basis (Authorized Users) or on an exclusion basis (Exceptions).


 


Example: Allowing traffic for specific capabilities on a block rule


 


WAftring_5-1625249038922.png


 


These settings can also be configured via group policy as seen in the following document.


Isolating Apps on Your Network: Create Custom Firewall Rules 


 


Loopback traffic


 


Network communications using the loopback address cannot be used for application-to-application communication for UWP apps because it is restricted by network isolation.


As a consequence of network isolation, Windows disallows establishing a socket connection (Sockets or WinSock) between two UWP apps running on the same machine; whether that’s via the local loopback address (127.0.0.0), or by explicitly specifying the local IP address. For details about mechanisms by which UWP apps can communicate with one another, see App-to-app communication.


 


Source: https://docs.microsoft.com/en-us/windows/uwp/networking/sockets 


 


However, if the application-to-application communication is occurring within the same process then the communication is permitted.


 


Security Products


 


Some security applications will adjust components of the OS to leverage the loopback adapter.


Setting any network component, (DNS server, WinHttp proxy / WinInet proxy, etc.…) to the loopback address will lead to the traffic from any UWP applications that leverage those network components to be dropped by WFP. This is by-design behavior; however, it can be worked around if necessary.


 


Checking for loopback drops


The easiest way to check if there are packet drops due to network isolation is through WFP auditing.


Here is an example of how to check if a UWP applications traffic is being dropped by network isolation due to loopback communication.


First, enable WFP auditing with the following command:


 

auditpol /set /subcategory:"Filtering Platform Packet Drop" /success:enable /failure:enable

 


In my scenario, the Windows Store was unable to reach the internet. I reproduced this issue and reviewed the security event log for Event ID 5152:


 


Log Name:      Security


Source:        Microsoft-Windows-Security-Auditing


Date:          6/1/2021 7:09:39 AM


Event ID:      5152


Task Category: Filtering Platform Packet Drop


Level:         Information


Keywords:      Audit Failure


User:          N/A


Computer:      W2.contoso.com


Description:


The Windows Filtering Platform has blocked a packet.


 


Application Information:


        Process ID:              5884


        Application Name: deviceharddiskvolume1windowssystem32windowspowershellv1.0powershell.exe


 


Network Information:


        Direction:               Inbound


        Source Address:          127.0.0.1


        Source Port:             50961


        Destination Address:     127.0.0.1


        Destination Port:        9000


        Protocol:                6


 


Filter Information:


        Filter Run-Time ID:      67901


        Layer Name:              Receive/Accept


        Layer Run-Time ID:       44


 


From this information we can see that our packet was dropped with filter ID 67901. Let’s proceed to reviewing the filters we have in place to determine the reason for the drop. A dump of the current WFP filters can be generated by running the following command from an Admin Command Prompt:


 

netsh wfp show state file=wfpstate.xml

 


Within my wfpstate.xml the filter ID 67901 matches the following item. Based on the name of the filter responsible (AppContainerLoopback) for dropping the packet, I know that the packet is being dropped due to UWP loopback communication.


 

<item>
        <filterKey>{2d336b0c-dcb6-451c-bd3c-e5b22641c539}</filterKey>
        <displayData>
                 <name>AppContainerLoopback</name>
                 <description>AppContainerLoopback</description>
        </displayData>
        <flags/>
        <providerKey>{decc16ca-3f33-4346-be1e-8fb4ae0f3d62}</providerKey>
        <providerData>
                 <data>ffffffffffffffff</data>
                 <asString>........</asString>
        </providerData>
        <layerKey>FWPM_LAYER_ALE_AUTH_RECV_ACCEPT_V4</layerKey>
        <subLayerKey>{b3cdd441-af90-41ba-a745-7c6008ff2300}</subLayerKey>
        <weight>
                 <type>FWP_UINT64</type>
                 <uint64>18446744073709551614</uint64>
        </weight>
        <filterCondition numItems="2">
                 <item>
                         <fieldKey>FWPM_CONDITION_FLAGS</fieldKey>
                         <matchType>FWP_MATCH_FLAGS_ALL_SET</matchType>
                         <conditionValue>
                                  <type>FWP_UINT32</type>
                                  <uint32>1</uint32>
                         </conditionValue>
                 </item>
                 <item>
                         <fieldKey>FWPM_CONDITION_ALE_USER_ID</fieldKey>
                         <matchType>FWP_MATCH_EQUAL</matchType>
                         <conditionValue>
                                  <type>FWP_SECURITY_DESCRIPTOR_TYPE</type>
                                  <sd>O:LSD:(A;;CC;;;AC)(A;;CC;;;S-1-15-3-1)(A;;CC;;;S-1-15-3-2)(A;;CC;;;S-1-15-3-3)(A;;CC;;;S-1-15-3-4214768333-1334025770-122408079-3919188833)(A;;CC;;;WD)(A;;CC;;;AN)</sd>
                         </conditionValue>
                 </item>
        </filterCondition>
        <action>
                 <type>FWP_ACTION_BLOCK</type>
                 <filterType/>
        </action>
        <rawContext>0</rawContext>
        <reserved/>
        <filterId>67901</filterId>
        <effectiveWeight>
                 <type>FWP_UINT64</type>
                 <uint64>18446744073709551614</uint64>
        </effectiveWeight>
</item>

 


Working around UWP loopback communication


 


Note, this is intended for debugging purposes only.


In the example below, I will be adding an exemption for the Windows Store.


Let’s start by checking the current configuration of loopback communications using the CheckNetIsolation tool. The syntax, and example output is seen below.


 

PS C:> CheckNetIsolation.exe LoopbackExempt -s

List Loopback Exempted AppContainers

OK.

 


This is the output we would expect to see with no loopback exempt applications.


With that in mind, lets add my exemption for the Windows Store. First thing we need to do is find the AppID of the Windows Store. To do this we can run the PowerShell cmdlet Get-StartApps with one of the following syntaxes.


 

PS C:> Get-StartApps # For all applications
Name            AppID
----            -----       
Blend 2019                         Blend.28500c9f                                                   
Python 3.9 (64-bit)                C:Python39python.exe                                                            
Microsoft Store                    Microsoft.WindowsStore_8wekyb3d8bbwe!App                                                

PS C:> Get-StartApps -Name "Microsoft Store" # Or for a specific application

Name            AppID
----            -----
Microsoft Store Microsoft.WindowsStore_8wekyb3d8bbwe!App

 


The resulting AppID can be trimmed:



  • from Microsoft.WindowsStore_8wekyb3d8bbwe!App 

  • to Microsoft.WindowsStore_8wekyb3d8bbwe


Now adding the exemption for the rule will can be done using CheckNetIsolation with the syntax below.


 

PS C:> CheckNetIsolation.exe LoopbackExempt -a -n="Microsoft.WindowsStore_8wekyb3d8bbwe"
OK.

 


Confirm the loopback exemption rule has been added to the exemption list, with the syntax below.


 

PS C:> CheckNetIsolation.exe LoopbackExempt -s

List Loopback Exempted AppContainers

[1] -----------------------------------------------------------------
    Name: microsoft.windowsstore_8wekyb3d8bbwe
    SID:  S-1-15-2-1609473798-1231923017-684268153-4268514328-882773646-2760585773-1760938157

OK.

 


And now there is an exemption added for the Windows Store!


 


If you wanted to add all current UWP applications to the loopback exemption list, you could use a PowerShell script like this. Note, this may vary depending on AppID format and use at your own risk.


 

(Get-StartApps).AppID | ForEach-Object {
       $UWPApp = $_.Split("!")[0]
       CheckNetIsolation.exe LoopbackExempt -a -n="$UWPApp"
}

 


UWP listening on the loopback for traffic


Currently, it is not supported for UWP application to listen on the loopback adapter outside of Visual Studio.


This behavior is outlined in our documentation.


 


Note Loopback is permitted only for development purposes. Usage by a Windows Runtime app installed outside of Visual Studio is not permitted. Further, a Windows Runtime app can use an IP loopback only as the target address for a client network request. So, a Windows Runtime app that uses a DatagramSocket or StreamSocketListener to listen on an IP loopback address is prevented from receiving any incoming packets.


 


Source: Windows 8 Development: How to enable loopback for network access 


 


Determining what traffic an application is using


 


If the traffic an application is using is unknown, CheckNetIsolation can be used to determine how the OS is detecting the network traffic of a UWP application.


 


In our example, I will be investigating the Windows Store which will only be accessing resources out on the open internet and will not be receiving any unsolicited connections.


As seen in the loopback example we can pull the AppID with Get-StartApps using the syntax below.


 

PS C:> Get-StartApps -Name "Microsoft Store"

Name            AppID
----            -----
Microsoft Store Microsoft.WindowsStore_8wekyb3d8bbwe!App

 


As a reminder be sure to trim the trailing !App from the AppID.


 


Now using the CheckNetIsolation syntax below I can start a debug session to determine how the OS is detect the network boundary of traffic for the Windows Store.


 

PS C:> CheckNetIsolation.exe Debug -n="Microsoft.WindowsStore_8wekyb3d8bbwe"

Network Isolation Debug Session started.

Reproduce your scenario, then press Ctrl-C when done.

 


Once I’ve reproduced my issue, I can input Ctrl+C to stop the data collection and a report similar to the one below will be generated.


 

PS C:> CheckNetIsolation.exe Debug -n="Microsoft.WindowsStore_8wekyb3d8bbwe"

Network Isolation Debug Session started.

Reproduce your scenario, then press Ctrl-C when done.

Collecting Logs.....

Summary Report
Network Capabilities Status
----------------------------------------------------------------------
    InternetClient                Used and Declared
    InternetClientServer          Not Used and Insecure

Detailed Traffic Report
----------------------------------------------------------------------
    InternetClient                Used and Declared
 ------------------------------------------------------------------
      23.196.35.33     23.196.35.33     23.196.35.33     104.87.85.147
      104.87.85.147    23.218.218.171   104.87.85.147    104.87.85.147
      104.87.85.147    104.87.85.147    104.87.85.147    104.87.85.147
      23.220.124.10

    InternetClientServer          Not Used and Insecure
 ------------------------------------------------------------------

OK.

 


In my scenario, only InternetClient traffic (meaning outbound traffic to endpoints outside my work boundary) was detected by the debug scenario.


 


Closing Notes:


 


I know I covered lots of in-depth information here, I appreciate if you have made it this far. Network isolation can be tricky, but with the information above you should be able to get started diagnosing issues in your environment. For additional information please see the section below.


 


Additional Reading





 

Azure Percept Audio – First Steps

Azure Percept Audio – First Steps

This article is contributed. See the original author and article here.

Welcome back to another blog post about the Azure Percept DK! 


 


Previously


 


In the previous post – Azure Percept – First Look – you’ll remember that we had a first look at the percept and what it was all about. Well, in this post we’ll take a look at the Azure Percept Audio Module, which allows for the recognition of Custom Keywords and Commands (among other things).


 


 


20210621_200106-Large


 


What is the Percept Audio?


 


The Azure Percept Audio (sometimes called the Percept Ear) is a “System on a Module” or SoM, which is designed as the Audio Interface for Audio Processing at the edge for the Azure Percept.


 


Along with the Carrier Board, Azure Percept Studio, Microsoft LUIS and Speech, the system can recognise keywords and commands to control devices using voice at the edge. This works both online and offline with the aid of the Carrier Board.


 


Azure Percept Audio Specifications


 


The basic specs for the Azure Percept Audio SoM are;


 



  • Four-microphone linear array and audio processing via XMOS Codec

  • 2x buttons

  • 3x LEDs

  • Micro USB

  • 3.5 mm audio jack


 


You can find the full specifications here


 


Who’s it for?


 


Like the Vision SoM, Microsoft clearly have a set of industries in mind for the Azure Percept Audio SoM;



  • Hospitality

  • Healthcare

  • Smart Buildings

  • Automotive

  • Retail

  • Manufacturing


With applications such as;



  • In-room Virtual Concierge

  • Vehicle Voice Assistant and Command/Control

  • Point of Sale Services and Quality Control

  • Warehouse Task Tracking


 


This becomes clear later when we look at the sample applications we can spin up in a minute.


 


Azure Percept Audio – Required Services


 


The Azure Percept Audio SoM makes use of a couple of Azure Services to process Audio;


 


LUIS (Language Understanding Intelligent Service):


 


LUIS is an Azure service which allows interaction with applications and devices using natural language.


 


Using a visual interface, we’re able to train AI models without the need for deep Machine Learning experience of any kind.


 


The Azure Percept uses LUIS to configure Custom Commands, allowing for a contextualised response to a given command.


 


Cognitive Speech:


 


Cognitive Speech is an Azure Service offering Text-to-speech, speech-to-text, speech translation and speaker recognition.


 


Supporting over 92 languages, this service can convert speech to text allowing for interactivity with apps and devices.


 


On the flip side, with support for over 215 different voices in 60 languages, the Speech Service can also convert Text to-Speech improving accessibility and interaction with devices and applications.


 


Finally, the Speech Service can also translate between 30 different languages, allowing for real-time translation using a variety of programming languages, which I think is a really cool use case.


 


The Percept uses this service amongst other things, to configure a wake word for the device, by default this is the word “computer“. (See Star Trek IV – The Voyage Home!).


 


Azure Percept Audio – Sample Applications


 


If we navigate to Azure Percept Studio, from the Overview Page we can select the “Demos & tutorials” tab at the top;


 


image-17


If we scroll to the bottom of this page, we have some links to some Speech tutorials and demos.


 


image-16


 


The first thing we’ll choose is “Try out voice assistant templates”. Clicking this link presents us with a fly out with a selection of templates to choose from;


 


image-18


 


You can see here a selection of Sample Templates that speak to where Microsoft expect the Percept Audio to be used. All of these a limited to voice commands interacting with an environment. I’ll speak later about some scenarios I’d actually like to be thought about that are outside of this use case.


 


For now, we’ll deploy one of these pre-backed samples and see how it works!


 


Azure Percept Audio – Hospitality Sample Template Setup


 


Choosing the “Hospitality” option, agreeing to the terms and continuing on, we’re shown the resource creation flyout.


 


Here we can select the subscription and resource group we’d like to deploy the various resources to.


 


We’re also prompted for an Application Prefix. This allows the template to create resources with unique ids.


 


We can then choose a region close to us. At the time of writing we can choose between West US and West Europe, but I imagine this will grow once the Percept starts getting towards GA. I was actually surprised at the choice of regions here with no East US, North Europe, and no APAC region at all.


 


Moving on, the last item we need to select is the “LUIS prediction pricing tier, which we can leave at “Standard”, as the free tier doesn’t support speech requests sadly.


 


image-19


Hitting the “Create” button, then begins the process of deploying the speech theme resources.


 


image-20


 


We’re then prompted that this process can take between 2 and 4 minutes to complete…. This only took a matter of seconds for me nicely…


 


image-21


 


Azure Percept Audio – Hospitality Sample Template Demo


 


Once the template has completed deploying we’re then shown a demo Hospitality environment.


 


We should also now have 3 blue LEDs showing on the Percept;


 


20210622_102254-Large


 


I found these LEDs to be super bright, such that I couldn’t stare directly at them without then being able to see three (or is it 5? Ha) dots like Picard in that episode of Next Gen. They light my whole office up at night practically!


 


The Percept Audio LEDs will indicate different statuses depending upon their colour and flash pattern;


 









































LED



LED State



Ear SoM Status


L02 1x white, static on Power on
L02 1x white, 0.5 Hz flashing Authentication in progress
L01 & L02 & L03 3x blue, static on Waiting for keyword
L01 & L02 & L03 LED array flashing, 20fps Listening or speaking
L01 & L02 & L03 LED array racing, 20fps Thinking
L01 & L02 & L03 3x red, static on Mute

 


The LEDs are labelled as shown in the following picture, with L01 on the left of the SoM, L02 in the middle and L03 on the far right;


 


LEDs


 


Returning to the Hospitality demo environment. The screen is split up into several sections.


 


HospitalityAreas


 


At the top of the demo environment we have an toolbar containing;


 



  • Create Custom Keyword

  • Create Custom Command

  • Get Started

  • Learn More

  • Feedback

  • Troubleshoot


Just below that we have the current keyword and command and links to change them should we wish…. We’ll actually be looking at all of that in another blog post, so keep your eyes peeled!


 


On the left we have an interaction area where we can enter commands for the Percept to action.


 


On the right we have a visual representation of the current environment, which reflects the actions our commands invoke.


 


Audio Output


 


Before we try executing any commands, the Percept uses the Speech Service to convert it’s command responses to spoken word.


 


For us to be able to hear that, we’ll need to connect some speakers to the device.


 


The Percept has a 3.5mm audio jack output for exactly that purpose… Hooking up some relatively low powered portable speakers to the line out jack will allow us to hear the responses to our commands.


 


AudioOutput


Executing Commands


We can now try executing some commands. The Custom Keyword or Wake Word for the Percept defaults to “Computer” (Where’s Scotty when you need him!), we can say that followed by one of a few commands which are applicable to this particular sample;


 



  • Turn on/off the lights

  • Turn on/off the TV.

  • Turn on/off the AC.

  • Open/close the blinds.

  • Set temperature to X degrees. (X is the desired temperature, e.g. 75.)


 


Azure-Percept-Screen-Time-0_19_1929-Large


 


I noticed, and perhaps due to my English accent, that it took a while for the Percept to recognise my pronunciation of “Computer”… I did try pronouncing it with an American Accent (and also asking it for the chemical formula for Plexiglass), but that didn’t seem to help.


 


Eventually it did work, and I quickly learnt how to say the word for a relatively repeatable wake up. I did notice that often, it would take quite a while to “Wake Up” the first time I issued the wake up word, and after that it would work quite quickly. I also noticed that, if I’d left it idle overnight that, in perfect IT Crowd style, I’d actually have to turn it off and back on to get it working again. When I get some time, I’ll raise some feedback with the team.


 


Once I’d mastered the wake word, all the other instructions worked pretty well…. You can see one of my failed attempts at the top here;


 


image-24


 


By instructing the Percept to turn on the TV, the simulation on the right would show the TV on, and so on through the commands.


 


Azure-Percept-Screen-Time-0_17_5329-Large-1


 


The only command that didn’t work as intended was the “Set Temperature” command, which didn’t accept the actual temperature as a parameter to the command. 


 


It turns out that this was because I was trying to set the temperature too low, you can only set it within a few degrees of the set temperature, otherwise it just doesn’t work.


 


My Plans


 


The first thing I’m going to try with this is hook it all up to a Raspberry Pi and recreate the Hospitality experience in real life. I think this would make a really cool demo for future talks… (Also, Microsoft, if you need somebody to come and create you a demo room in Seattle, just shout eh! ;) Haha).


 


I did ask the team about perhaps using the Percept Audio to detect things other than speech. As I mentioned in my previous post, I have a client in the Ecology and Wildlife ecosystem, and I’d love to perhaps train the Percept to recognise the sounds of wildlife maybe? 


 


My Thoughts


 


Having spent time making Alexa Skills, Speech Studio is quite limited in comparison to the tools around Alexa, but it’s got everything we need at the moment to make reasonable speech based interaction apps.


 


I did find it frustrating that it would either not understand me, or be really slow to wake to the wake word… This makes demoing the unit a bit hit and miss and elicits the usual sniggers from attendees…. Ha.


 


Those points aside, I found the experience worked well, with the Sample Applications being a great example of some of the ideas Microsoft have in mind for this side of the Percept.

Friday Five: Azure Meets Raspberry Pi, Endpoint Manager, More!

Friday Five: Azure Meets Raspberry Pi, Endpoint Manager, More!

This article is contributed. See the original author and article here.

image.png


Bird Detector Based on Microsoft Azure and Raspberry Pi


Jiong Shi has been a Microsoft MVP for twelve years, who is interested in Windows 10 IoT Core, Windows Embedded, Azure IoT and UWP. He is an associate professor in School of Computer and Electronic Engineering, Zhejiang Wanli University, China. He is an author of the book “Windows 10 IoT Application Developer Guide”, a blogger, and a speaker for Ignite China. Jiong is active in local developer community, speaking at technical conferences, writing articles on hackster, contributing to Windows IoT Core open-source projects, serving as a mentor and Microsoft Community Contributor. Follow him on Twitter @dearsj001


silviodibenetto.jpg


MICROSOFT ENDPOINT MANAGER: HOW TO CONFIGURE WINDOWS FIREWALL POLICIES


Silvio Di Benedetto is founder and CEO at Inside Technologies. He is a Digital Transformation helper, and Microsoft MVP for Cloud Datacenter Management. Silvio is a speaker and author, and collaborates side-by-side with some of the most important IT companies including Microsoft, Veeam, Parallels, and 5nine to provide technical sessions. Follow him on Twitter @s_net.


image.png


C#.NET: HOW TO UNZIP FOLDER


Asma Khalid is an Entrepreneur, ISV, Product Manager, Full Stack .Net Expert, Community Speaker, Contributor, and Aspiring YouTuber. Asma counts more than 7 years of hands-on experience in Leading, Developing & Managing IT-related projects and products as an IT industry professional. Asma is the first woman from Pakistan to receive the MVP award three times, and the first to receive C-sharp corner online developer community MVP award four times. See her blog here.


ChrisH-1Edit.PNG


Teams Real Simple with Pictures: Getting Hands on with Profile+


Chris Hoard is a Microsoft Certified Trainer Regional Lead (MCT RL), Educator (MCEd) and Teams MVP. With over 10 years of cloud computing experience, he is currently building an education practice for Vuzion (Tier 2 UK CSP). His focus areas are Microsoft Teams, Microsoft 365 and entry-level Azure. Follow Chris on Twitter at @Microsoft365Pro and check out his blog here.


20180904081913-IMG_0221_medium copy.jpg


How to create Webinars with Microsoft Teams


Vesku Nopanen is a Principal Consultant in Office 365 and Modern Work and passionate about Microsoft Teams. He helps and coaches customers to find benefits and value when adopting new tools, methods, ways or working and practices into daily work-life equation. He focuses especially on Microsoft Teams and how it can change organizations’ work. He lives in Turku, Finland. Follow him on Twitter: @Vesanopanen