I'm trying to automate the creation of a TermStore term and apply a simple navigation link. I finally got my Azure Function to connect to SPO and query data, but when I use the New-PnPTerm command below, I get an access denied error.
Connect-PnPOnline -ClientId $appId -Thumbprint $thumbPrint –Url https://<tenant>-admin.sharepoint.com -Tenant <tenant>.onmicrosoft.com
New-PnPTerm -TermSet <termset> -TermGroup "Navigation" -Name $item.FieldValues.Title -LocalCustomProperties @{"_Sys_Nav_SimpleLinkUrl"="$($item.FieldValues.SharePointURL)"}
[Error] ERROR: Access denied. You do not have permission to perform this action or access this resource
My Azure Function uses a certificate to authenticate via the Azure AD app registration, which has the following API permissions:
- Graph.Group.ReadWrite.All
- Graph.TermStore.ReadWrite.All
- Graph.User.ReadWrite.All
- SharePoint.AllSites.FullControl
- SharePoint.Sites.FullControl.All
- SharePoint.TermStore.ReadWrite.All
- SharePoint.User.ReadWrite.All
Even better would be if this can be done in a Logic App. I wasn't able to find a connector or REST endpoint that would support this. Thanks in advance for any advice.