Skip to content

Commit da2aa0a

Browse files
committed
Removed UseWebLogin example due to deprecation
1 parent d2d2a82 commit da2aa0a

File tree

1 file changed

+21
-42
lines changed

1 file changed

+21
-42
lines changed

documentation/Connect-PnPOnline.md

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,6 @@ Connect-PnPOnline [-ReturnConnection] [-Url] <String> [-CreateDrive] [-DriveName
5656
[-AzureADLoginEndPoint <string>] [-Connection <PnPConnection>]
5757
```
5858

59-
### Web Login for Multi Factor Authentication
60-
```powershell
61-
Connect-PnPOnline [-ReturnConnection] [-Url] <String> [-CreateDrive] [-DriveName <String>]
62-
[-TenantAdminUrl <String>] [-UseWebLogin] [-ForceAuthentication]
63-
[-ValidateConnection]
64-
```
65-
6659
### Interactive for Multi Factor Authentication
6760
```powershell
6861
Connect-PnPOnline -Interactive [-ReturnConnection] -Url <String> [-CreateDrive] [-DriveName <String>] [-LaunchBrowser]
@@ -127,37 +120,37 @@ See https://pnp.github.io/powershell/articles/connecting.html for more informati
127120

128121
### EXAMPLE 1
129122
```powershell
130-
Connect-PnPOnline -Url "contoso.sharepoint.com"
123+
Connect-PnPOnline -Url "https://contoso.sharepoint.com"
131124
```
132125

133126
Connect to SharePoint prompting for the username and password.
134127
When a generic credential is added to the Windows Credential Manager with https://contoso.sharepoint.com, PowerShell will not prompt for username and password and use those stored credentials instead.
135128

136129
### EXAMPLE 2
137130
```powershell
138-
Connect-PnPOnline -Url "contoso.sharepoint.com" -Credentials (Get-Credential)
131+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -Credentials (Get-Credential)
139132
```
140133

141134
Connect to SharePoint prompting for the username and password to use to authenticate
142135

143136
### EXAMPLE 3
144137
```powershell
145-
Connect-PnPOnline -Url "contoso.sharepoint.de" -ClientId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -ClientSecret $clientSecret
138+
Connect-PnPOnline -Url "https://contoso.sharepoint.de" -ClientId 344b8aab-389c-4e4a-8fa1-4c1ae2c0a60d -ClientSecret $clientSecret
146139
```
147140

148141
This will authenticate you to the site using Legacy ACS authentication
149142

150143
### EXAMPLE 4
151144
```powershell
152-
Connect-PnPOnline -Url "contoso.sharepoint.com" -DeviceLogin
145+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -DeviceLogin
153146
```
154147

155148
This will authenticate you using the PnP Management Shell Multi-Tenant application.
156149
A browser window will have to be opened where you have to enter a code that is shown in your PowerShell window.
157150

158151
### EXAMPLE 5
159152
```powershell
160-
Connect-PnPOnline -Url "contoso.sharepoint.com" -DeviceLogin -LaunchBrowser
153+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -DeviceLogin -LaunchBrowser
161154
```
162155

163156
This will authenticate you using the PnP Management Shell Multi-Tenant application.
@@ -166,15 +159,15 @@ A browser window will automatically open and the code you need to enter will be
166159
### EXAMPLE 6
167160
```powershell
168161
$password = (ConvertTo-SecureString -AsPlainText 'myprivatekeypassword' -Force)
169-
Connect-PnPOnline -Url "contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -CertificatePath 'c:\mycertificate.pfx' -CertificatePassword $password -Tenant 'contoso.onmicrosoft.com'
162+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -CertificatePath 'c:\mycertificate.pfx' -CertificatePassword $password -Tenant 'contoso.onmicrosoft.com'
170163
```
171164

172165
Connects using an Azure Active Directory registered application using a locally available certificate containing a private key.
173166
See https://learn.microsoft.com/sharepoint/dev/solution-guidance/security-apponly-azuread for a sample on how to get started.
174167

175168
### EXAMPLE 7
176169
```powershell
177-
Connect-PnPOnline -Url "contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -Tenant 'contoso.onmicrosoft.com' -Thumbprint 34CFAA860E5FB8C44335A38A097C1E41EEA206AA
170+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -Tenant 'contoso.onmicrosoft.com' -Thumbprint 34CFAA860E5FB8C44335A38A097C1E41EEA206AA
178171
```
179172

180173
Connects to SharePoint using app-only tokens via an app's declared permission scopes.
@@ -183,37 +176,23 @@ Ensure you have imported the private key certificate, typically the .pfx file, i
183176

184177
### EXAMPLE 8
185178
```powershell
186-
Connect-PnPOnline -Url "contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -CertificateBase64Encoded $base64encodedstring -Tenant 'contoso.onmicrosoft.com'
179+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28 -CertificateBase64Encoded $base64encodedstring -Tenant 'contoso.onmicrosoft.com'
187180
```
188181

189182
Connects using an Azure Active Directory registered application using a certificate with a private key that has been base64 encoded.
190183
See https://learn.microsoft.com/sharepoint/dev/solution-guidance/security-apponly-azuread for a sample on how to get started.
191184

185+
192186
### EXAMPLE 9
193187
```powershell
194-
Connect-PnPOnline -Url "contoso.sharepoint.com" -UseWebLogin
188+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -Interactive -ClientId 6c5c98c7-e05a-4a0f-bcfa-0cfc65aa1f28
195189
```
196190

197-
Note: See Example 10 as this is a preferred option over using -UseWebLogin.
191+
Connects to the Azure AD, acquires an access token and allows PnP PowerShell to access both SharePoint and the Microsoft Graph. Notice that you will have to register your own App first, by means of Register-PnPEntraIDAdd to use this method. You will also have to provide the -ClientId parameter starting September 9, 2024. Alternatively, create an environment variable, call it "ENTRAID_APP_ID" and set the value to the app id you created. If you use -Interactive and this environment variable is present you will not have to use -ClientId.
198192

199-
Connects to SharePoint using legacy cookie based authentication.
200-
Notice this type of authentication is limited in its functionality.
201-
We will for instance not be able to acquire an access token for the Graph, and as a result none of the Graph related cmdlets will work.
202-
Also some of the functionality of the provisioning engine (Get-PnPSiteTemplate, Get-PnPTenantTemplate, Invoke-PnPSiteTemplate, Invoke-PnPTenantTemplate) will not work because of this reason.
203-
The cookies will in general expire within a few days and if you use -UseWebLogin within that time popup window will appear that will disappear immediately, this is expected.
204-
Use -ForceAuthentication to reset the authentication cookies and force a new login.
205-
See example 10 for a full support for interactive logins using MFA and the ability to acquire Graph tokens.
206193

207194
### EXAMPLE 10
208195
```powershell
209-
Connect-PnPOnline -Url "contoso.sharepoint.com" -Interactive
210-
```
211-
212-
Connects to the Azure AD, acquires an access token and allows PnP PowerShell to access both SharePoint and the Microsoft Graph.
213-
By default it will use the PnP Management Shell multi-tenant application behind the scenes, so make sure to run \`Register-PnPManagementShellAccess\` first.
214-
215-
### EXAMPLE 11
216-
```powershell
217196
Connect-PnPOnline -Url "https://portal.contoso.com" -TransformationOnPrem -CurrentCredential
218197
```
219198

@@ -222,38 +201,38 @@ This option is only supported for being able to transform on-premises classic wi
222201
Although other PnP cmdlets might work as well, they're officially not supported for being used in an on-premises context.
223202
See http://aka.ms/sharepoint/modernization/pages for more details on page transformation.
224203

225-
### EXAMPLE 12
204+
### EXAMPLE 11
226205
```powershell
227-
Connect-PnPOnline -Url contoso.sharepoint.com -ManagedIdentity
206+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -ManagedIdentity
228207
Get-PnPTeamsTeam
229208
```
230209

231210
Connects using a system assigned managed identity to Microsoft Graph. Using this way of connecting only works with environments that support managed identities: Azure Functions, Azure Automation Runbooks and the Azure Cloud Shell. Read up on [this article](https://pnp.github.io/powershell/articles/azurefunctions.html#by-using-a-managed-identity) how it can be used.
232211

233-
### EXAMPLE 13
212+
### EXAMPLE 12
234213
```powershell
235-
Connect-PnPOnline -Url contoso.sharepoint.com -ManagedIdentity -UserAssignedManagedIdentityObjectId 363c1b31-6872-47fd-a616-574d3aec2a51
214+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -ManagedIdentity -UserAssignedManagedIdentityObjectId 363c1b31-6872-47fd-a616-574d3aec2a51
236215
Get-PnPList
237216
```
238217

239218
Connects using an user assigned managed identity with object/principal ID 363c1b31-6872-47fd-a616-574d3aec2a51 to SharePoint Online. Using this way of connecting only works with environments that support managed identities: Azure Functions, Azure Automation Runbooks and the Azure Cloud Shell. Read up on [this article](https://pnp.github.io/powershell/articles/azurefunctions.html#by-using-a-managed-identity) how it can be used.
240219

241-
### EXAMPLE 14
220+
### EXAMPLE 13
242221
```powershell
243-
Connect-PnPOnline -Url contoso.sharepoint.com -AccessToken $token
222+
Connect-PnPOnline -Url "https://contoso.sharepoint.com" -AccessToken $token
244223
```
245224

246225
This method assumes you have acquired a valid OAuth2 access token from Azure AD with the correct audience and permissions set.
247226
Using this method PnP PowerShell will not acquire tokens dynamically and if the token expires (typically after 1 hour) cmdlets will fail to work using this method.
248227

249-
### EXAMPLE 15
228+
### EXAMPLE 14
250229
```powershell
251230
Connect-PnPOnline -Url contoso.sharepoint.com -EnvironmentVariable -Tenant 'contoso.onmicrosoft.com'
252231
```
253232

254233
This example uses the `AZURE_CLIENT_CERTIFICATE_PATH` and `AZURE_CLIENT_CERTIFICATE_PASSWORD` environment variable values to authenticate. The `AZURE_CLIENT_ID` environment variable must be present and `Tenant` parameter value must be provided.
255234

256-
### EXAMPLE 16
235+
### EXAMPLE 15
257236
```powershell
258237
Connect-PnPOnline -Url contoso.sharepoint.com -EnvironmentVariable
259238
```
@@ -268,14 +247,14 @@ If `AZURE_USERNAME`, `AZURE_PASSWORD` and `AZURE_CLIENT_ID`, we will use these e
268247

269248
We support only Service principal with certificate and Username with password mode for authentication. Configuration will be attempted in that order. For example, if values for a certificate and username+password are both present, the client certificate method will be used.
270249

271-
### EXAMPLE 17
250+
### EXAMPLE 16
272251
```
273252
Connect-PnPOnline -Url contoso.sharepoint.com -AzureEnvironment Custom -MicrosoftGraphEndPoint "custom.graph.microsoft.com" -AzureADLoginEndPoint "https://custom.login.microsoftonline.com"
274253
```
275254

276255
Use this method to connect to a custom Azure Environment. You can also specify the `MicrosoftGraphEndPoint` and `AzureADLoginEndPoint` parameters if applicable. If specified, then these values will be used to make requests to Graph and to retrieve access token.
277256

278-
### EXAMPLE 18
257+
### EXAMPLE 17
279258
```powershell
280259
Connect-PnPOnline -Url contoso.sharepoint.com -AzureADWorkloadIdentity
281260
```

0 commit comments

Comments
 (0)