Skip to main content
added screenshot of running script
Source Link
Kim B
  • 367
  • 3
  • 15

I'm trying to add organizational asset library but it fails as Unauthorized operation tried both SPO and PnP cmdlets.

$AssetsLibraryURL ="https://tenant.sharepoint.com/sites/Site/Kuvapankki"
$AssetsDocLibraryURL = "https://tenant.sharepoint.com/sites/Site/Dokumenttipohjat"
$ThumbnailUrl = "https://tenant.sharepoint.com/sites/Site/Kuvapankki/300w/Badge-Turqoise.png"

Connect-SPOService https://tenant-admin.sharepoint.com
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/Kassler -UseWebLogin   
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Both cmdlets return the same error

Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL  -ThumbnailU ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : NotSpecified: (:) [Add-SPOOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerUnauthorizedAccessException,Microsoft.Online.SharePoint.PowerShell.AddSPOOrgAssetsLibrary

Add-PnPOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : WriteError: (:) [Add-PnPOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Admin.AddOrgAssetsLibrary

Both SPO PowerShell and PnP PowerShell are in latest version and using Global Admin account.

Sample of running the script

I'm trying to add organizational asset library but it fails as Unauthorized operation tried both SPO and PnP cmdlets.

$AssetsLibraryURL ="https://tenant.sharepoint.com/sites/Site/Kuvapankki"
$AssetsDocLibraryURL = "https://tenant.sharepoint.com/sites/Site/Dokumenttipohjat"
$ThumbnailUrl = "https://tenant.sharepoint.com/sites/Site/Kuvapankki/300w/Badge-Turqoise.png"

Connect-SPOService https://tenant-admin.sharepoint.com
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/Kassler -UseWebLogin   
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Both cmdlets return the same error

Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL  -ThumbnailU ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : NotSpecified: (:) [Add-SPOOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerUnauthorizedAccessException,Microsoft.Online.SharePoint.PowerShell.AddSPOOrgAssetsLibrary

Add-PnPOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : WriteError: (:) [Add-PnPOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Admin.AddOrgAssetsLibrary

Both SPO PowerShell and PnP PowerShell are in latest version and using Global Admin account.

I'm trying to add organizational asset library but it fails as Unauthorized operation tried both SPO and PnP cmdlets.

$AssetsLibraryURL ="https://tenant.sharepoint.com/sites/Site/Kuvapankki"
$AssetsDocLibraryURL = "https://tenant.sharepoint.com/sites/Site/Dokumenttipohjat"
$ThumbnailUrl = "https://tenant.sharepoint.com/sites/Site/Kuvapankki/300w/Badge-Turqoise.png"

Connect-SPOService https://tenant-admin.sharepoint.com
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/Kassler -UseWebLogin   
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Both cmdlets return the same error

Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL  -ThumbnailU ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : NotSpecified: (:) [Add-SPOOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerUnauthorizedAccessException,Microsoft.Online.SharePoint.PowerShell.AddSPOOrgAssetsLibrary

Add-PnPOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : WriteError: (:) [Add-PnPOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Admin.AddOrgAssetsLibrary

Both SPO PowerShell and PnP PowerShell are in latest version and using Global Admin account.

Sample of running the script

Source Link
Kim B
  • 367
  • 3
  • 15

Unable to add Organization Asset library in SPO due Unauthorized operation

I'm trying to add organizational asset library but it fails as Unauthorized operation tried both SPO and PnP cmdlets.

$AssetsLibraryURL ="https://tenant.sharepoint.com/sites/Site/Kuvapankki"
$AssetsDocLibraryURL = "https://tenant.sharepoint.com/sites/Site/Dokumenttipohjat"
$ThumbnailUrl = "https://tenant.sharepoint.com/sites/Site/Kuvapankki/300w/Badge-Turqoise.png"

Connect-SPOService https://tenant-admin.sharepoint.com
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Connect-PnPOnline -Url https://tenant.sharepoint.com/sites/Kassler -UseWebLogin   
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType ImageDocumentLibrary
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL -ThumbnailUrl $ThumbnailUrl -OrgAssetType OfficeTemplateLibrary

Both cmdlets return the same error

Add-SPOOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-SPOOrgAssetsLibrary -LibraryUrl $AssetsDocLibraryURL  -ThumbnailU ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : NotSpecified: (:) [Add-SPOOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerUnauthorizedAccessException,Microsoft.Online.SharePoint.PowerShell.AddSPOOrgAssetsLibrary

Add-PnPOrgAssetsLibrary : Attempted to perform an unauthorized operation.
At line:1 char:1
Add-PnPOrgAssetsLibrary -LibraryUrl $AssetsLibraryURL -ThumbnailUrl $ ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    CategoryInfo          : WriteError: (:) [Add-PnPOrgAssetsLibrary], ServerUnauthorizedAccessException
    FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.Admin.AddOrgAssetsLibrary

Both SPO PowerShell and PnP PowerShell are in latest version and using Global Admin account.