/// <summary> /// Connect using the paramater set TOKEN /// </summary> /// <returns>PnPConnection based on the parameters provided in the parameter set</returns> private PnPConnection ConnectACSAppOnly() { if (PnPConnection.CurrentConnection?.ClientId == ClientId && PnPConnection.CurrentConnection?.ClientSecret == ClientSecret && PnPConnection.CurrentConnection?.Tenant == AADDomain) { ReuseAuthenticationManager(); } return(PnPConnectionHelper.InstantiateACSAppOnlyConnection(new Uri(Url), AADDomain, ClientId, ClientSecret, TenantAdminUrl, AzureEnvironment)); }
/// <summary> /// Connect using the paramater set TOKEN /// </summary> /// <returns>PnPConnection based on the parameters provided in the parameter set</returns> private PnPConnection ConnectACSAppOnly() { CmdletMessageWriter.WriteFormattedMessage(this, new CmdletMessageWriter.Message { Text = "Connecting with Client Secret uses legacy authentication and provides limited functionality. We can for instance not execute requests towards the Microsoft Graph, which limits cmdlets related to Microsoft Teams, Microsoft Planner, Microsoft Flow and Microsoft 365 Groups. You can hide this warning by using Connect-PnPOnline [your parameters] -WarningAction Ignore", Formatted = true, Type = CmdletMessageWriter.MessageType.Warning }); if (PnPConnection.CurrentConnection?.ClientId == ClientId && PnPConnection.CurrentConnection?.ClientSecret == ClientSecret && PnPConnection.CurrentConnection?.Tenant == AADDomain) { ReuseAuthenticationManager(); } return(PnPConnectionHelper.InstantiateACSAppOnlyConnection(new Uri(Url), AADDomain, ClientId, ClientSecret, TenantAdminUrl, AzureEnvironment)); }