-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #738 from ValerasNarbutas/sample/appregistrationan…
…dlogin simple sample how to login with app
- Loading branch information
Showing
4 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
plugin: add-to-gallery | ||
--- | ||
|
||
# Register an app in Azure Entry ID, login to SharePoint Online and set files links expiration in days | ||
|
||
## Summary | ||
|
||
This script shows how to register an app in Azure Entry ID, login to SharePoint Online and set files links expiration in days. | ||
|
||
## Implementation | ||
|
||
- Open Windows PowerShell | ||
- Edit Script and add required parameters for Site URL, tenant | ||
- Press run | ||
|
||
# [PnP PowerShell](#tab/pnpps) | ||
```powershell | ||
###### Declare and Initialize Variables ###### | ||
$tenant = "[tenant].onmicrosoft.com" | ||
$url="https://[tenant].sharepoint.com/sites/[site name]" | ||
###### Register an app in Azure Entry ID, store command in result to be able access certificate ###### | ||
$result = Register-PnPEntraIDApp -ApplicationName "PnP Rocks" -Tenant $tenant -interactive | ||
Connect-PnPOnline $url -ClientId $result.'AzureAppId/ClientId' -Tenant $tenant -CertificatePath $result.'Pfx file' | ||
###### Set files links expiration in days ###### | ||
Set-PnPTenantSite -identity $url -RequestFilesLinkExpirationInDay 50 | ||
``` | ||
[!INCLUDE [More about PnP PowerShell](../../docfx/includes/MORE-PNPPS.md)] | ||
|
||
|
||
*** | ||
|
||
## Contributors | ||
|
||
| Author(s) | | ||
|-----------| | ||
| Valeras Narbutas | | ||
|
||
[!INCLUDE [DISCLAIMER](../../docfx/includes/DISCLAIMER.md)] | ||
<img src="https://m365-visitor-stats.azurewebsites.net/script-samples/scripts/spo-register-app-login-using-app" aria-hidden="true" /> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions
56
scripts/spo-register-app-login-using-app/assets/sample.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[ | ||
{ | ||
"name": "spo-register-app-login-using-app", | ||
"source": "pnp", | ||
"title": "Register and login to SharePoint using an app", | ||
"shortDescription": "This script sample shows how to register an app in SharePoint and login to SharePoint using the app.", | ||
"url": "https://pnp.github.io/script-samples/spo-register-app-login-using-app/README.html", | ||
"longDescription": [ | ||
"This script sample shows how to register an app in SharePoint and login to SharePoint using the app." | ||
], | ||
"creationDateTime": "2024-09-13", | ||
"updateDateTime": "2024-09-13", | ||
"products": [ | ||
"SharePoint" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "PNP-POWERSHELL", | ||
"value": "2.10.0" | ||
} | ||
], | ||
"categories": [ | ||
"Data", | ||
"Migration", | ||
"Provision" | ||
], | ||
"tags": [ | ||
"Connect-PnPOnline", | ||
"Register-PnPEntraIDApp" | ||
|
||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://raw.githubusercontent.com/pnp/script-samples/main/scripts/spo-register-app-login-using-app/assets/preview.png", | ||
"alt": "" | ||
} | ||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "ValerasNarbutas", | ||
"company": "", | ||
"pictureUrl": "https://avatars.githubusercontent.com/u/16476453?s=400&v=4", | ||
"name": "Valeras Narbutas" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Want to learn more about PnP PowerShell and the cmdlets", | ||
"description": "Check out the PnP PowerShell site to get started and for the reference to the cmdlets.", | ||
"url": "https://aka.ms/pnp/powershell" | ||
} | ||
] | ||
} | ||
] |