0
votes

I want to add an item to a list in SharePoint Online using a runbook in Azure Automation. Add an item as below, but the message "Push notification function is not active on site 'https://[tenantID].sharepoint.com/sites/[sitename]'" appears and I cannot add it. If you execute the same command in local PowerShell, you can add items, but I do not know the cause, so please let me know. Sorry for your inconvenience.

` $Credential = Get-AutomationPSCredential -Name 'admin' $SiteUrl = "https://[tenantID].sharepoint.com/sites/[sitename]" Connect-PnPOnline –Url $SiteUrl –Credentials (Get-Credential -Credential $Credential)

Add-PnPListItem -List $ListName -Values @{"Title" = "TestTitle";"ID" = "TestID";"Message" = "TestMessage";} `

2

2 Answers

0
votes

Where are credentials stored? I do recommend to store them in Azure KeyVault. Here is sameple script

$login=(Get-AzKeyVaultSecret -VaultName "" -Name "").SecretValueText
$password=(Get-AzKeyVaultSecret -VaultName "" -Name "").SecretValueText
$secpasswd = ConvertTo-SecureString $password -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ($login, $secpasswd)
$url=""
Connect-PnPOnline -Url $url -Credentials $mycreds
0
votes

Please have a try this solution to fix the error:

Connect-PnPOnline https:/ /mytenant.sharepoint.com

Enable-PnPFeature -Identity 41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092 

BR