Skip to content

Commit

Permalink
Merge pull request #738 from ValerasNarbutas/sample/appregistrationan…
Browse files Browse the repository at this point in the history
…dlogin

simple sample how to login with app
  • Loading branch information
pkbullock authored Sep 21, 2024
2 parents 3ca9a2c + 6a7bae9 commit 58a462f
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scripts/spo-register-app-login-using-app/README.md
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 scripts/spo-register-app-login-using-app/assets/sample.json
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"
}
]
}
]

0 comments on commit 58a462f

Please sign in to comment.