Use Self Control App

-->

When using SharePoint Online you can define applications in Azure AD and these applications can be granted permissions to SharePoint, but also to all the other services in Office 365. This model is the preferred model in case you’re using SharePoint Online, if you’re using SharePoint on-premises you have to use the SharePoint Only model via based Azure ACS as described in here.

SelfControl is a free and open-source application for macOS that lets you block your own access to distracting websites, your mail servers, or anything else on the Internet. Just set a period of time to block for, add sites to your blacklist, and click 'Start.' I got my D-U-N-S number, entered it in my Apple developer account, and listed the app shortly after. In less time than a lunch break, you can take control of your business credit. Each of the business credit agencies has its own rating and scoring system.

Important

Azure Access Control (ACS), a service of Azure Active Directory (Azure AD), has been retired on November 7, 2018. This retirement does not impact the SharePoint Add-in model, which uses the https://accounts.accesscontrol.windows.net hostname (which is not impacted by this retirement). For more information, see Impact of Azure Access Control retirement for SharePoint Add-ins.

Setting up an Azure AD app for app-only access

In Azure AD when doing app-only you typically use a certificate to request access: anyone having the certificate and its private key can use the app and the permissions granted to the app. Below steps walk you through the setup of this model.

You are now ready to configure the Azure AD Application for invoking SharePoint Online with an App Only access token. To do that, you have to create and configure a self-signed X.509 certificate, which will be used to authenticate your Application against Azure AD, while requesting the App Only access token. First you must create the self-signed X.509 Certificate, which can be created using the makecert.exe tool that is available in the Windows SDK or through a provided PowerShell script which does not have a dependency to makecert. Using the PowerShell script is the preferred method and is explained in this chapter.

Self

Important

It's important that you run the below scripts with Administrator privileges.

To create a self signed certificate with this script:

Note

The dates are provided in ISO date format: YYYY-MM-dd

The actual script can be copied from here:

You will be asked to give a password to encrypt your private key, and both the .PFX file and .CER file will be exported to the current folder.

Next step is registering an Azure AD application in the Azure Active Directory tenant that is linked to your Office 365 tenant. To do that, open the Office 365 Admin Center (https://admin.microsoft.com) using the account of a user member of the Tenant Global Admins group. Click on the 'Azure Active Directory' link that is available under the 'Admin centers' group in the left-side treeview of the Office 365 Admin Center. In the new browser's tab that will be opened you will find the Microsoft Azure portal. If it is the first time that you access the Azure portal with your account, you will have to register a new Azure subscription, providing some information and a credit card for any payment need. But don't worry, in order to play with Azure AD and to register an Office 365 Application you will not pay anything. In fact, those are free capabilities. Once having access to the Azure portal, select the 'Azure Active Directory' section and choose the option 'App registrations'. See the next figure for further details.

In the 'App registrations' tab you will find the list of Azure AD applications registered in your tenant. Click the 'New registration' button in the upper left part of the blade. Next, provide a name for your application and click on 'Register' at the bottom of the blade.

How

Important

Once the application has been created copy the 'Application (client) ID' as you’ll need it later.

Now click on 'API permissions' in the left menu bar, and click on the 'Add a permission' button. A new blade will appear. Here you choose the permissions that you will grant to this application. Choose i.e.:

  • SharePoint
    • Application permissions
      • Sites
        • Sites.FullControl.All

Click on the blue 'Add permissions' button at the bottom to add the permissions to your application. The 'Application permissions' are those granted to the application when running as App Only.

Final step is “connecting” the certificate we created earlier to the application. Click on 'Certificates & secrets' in the left menu bar. Click on the 'Upload certificate' button, select the .CER file you generated earlier and click on 'Add' to upload it.

To confirm that the certificate was successfully registered, click on 'Manifest' in the left menu bar. Search for the keyCredentials property. It should look like:

If you see a section looking somewhat similar to this, the certificate has been added successfully.

In this sample the Sites.FullControl.All application permission require admin consent in a tenant before it can be used. In order to do this, click on 'API permissions' in the left menu again. At the bottom you will see a section 'Grant consent'. Click on the 'Grant admin consent for {{organization name}}' button and confirm the action by clicking on the 'Yes' button that appears at the top.

Using this principal with PnP PowerShell

If you want to use this AAD App Only principal with PnP PowerShell, after you have installed the PnP PowerShell module, you can connect to your SharePoint Online environment using:

You can now perform operations through PnP PowerShell against your SharePoint Online environment using this certificate App Only trust.

Note

PnP PowerShell is an open-source solution with active community providing support for it. There is no SLA for the open-source tool support from Microsoft.

Using this principal in your application using the SharePoint PnP Sites Core library

In a first step, you add the SharePointPnPCoreOnline library NuGet package: https://www.nuget.org/packages/SharePointPnPCoreOnline.

Once that’s done you can use below code construct: Gsyncit serial keygens.

How To Use Self Control App

Note

PnP Core Component, (aka: PnP Sites Core) is an open-source solution with active community providing support for it. There is no SLA for the open-source tool support from Microsoft.

Using this principal in your Powershell script using the PnP Sites core library

When making use of Azure Automation Runbooks, first add the certificate (.pfx) using the Certificates option (under Shared Resources), then use the Get-AutomationCertificate cmdlet to retrieve the certificate to be used in the script.

Note

You need to add the SharePointPnPPowerShellOnline module to your Automation Account first. This module contains the OfficeDevPnP.Core.dll assembly needed to make the authentication call.

Using this principal in your application and make use of the Azure KeyVault to store the certificate and retrieve it using an Azure Function

Add a Managed Identity to the Azure Function and give this identity access (GET permission on Secrets) to the KeyVault.

Below there is a slightly different call to the same GetAzureADAppOnlyAuthenticatedContext method where we pass an actual certificate instead of a path to the certificate. An extra function is added to retrieve to certificate from the KeyVault using the managed identity of the Azure Function, this retrieval is seamless and transparent since the 'magic' happens in the AzureServiceTokenProvider.

Using this principal with the Pnp Modernization Scanner

Now you have created the Azure Active Directory Application Registration, proceed with following the steps here to use this principal with the tool.

FAQ

How To Use Self Control App

Can I use other means besides certificates for realizing app-only access for my Azure AD app?

Use Self Control In A Sentence

No, all other options are blocked by SharePoint Online and will result in an Access Denied message.