Power BI – Error – Contact your admin to enable embed code creation

Microsoft Power BI When a user tries to create new embed codes using the “Publish to Web” feature, he/she/them will get the error “Contact your admin to enable embed code creation”.

Cause of the error

The reason behind this issue is, Microsoft changed the default state of “Publish to web” setting in tenant admin settings. Previously it used to be “Allow existing and new codes” and now it’s “Only allow existing codes”

The fix

The fix is simple, just change the settings to “Allow existing and new codes” and users should be able to publish to web.

The security issue & fix

But wait still the security issue exists. Any user can publish to the web and the report data is exposed to any user on the Internet who has access to the report URL. So the best course of action is to enable the additional security settings, which is “Apply to” “Specific security groups”. Once enabled, only users from a specific security group will be able to create embed codes using “Publish to web”.

For more documentation on the settings, please visit Microsoft Docs

Microsoft 365 plan comparison

One of the necessity of being a Microsoft 365 based architect is knowing the difference between various licenses or plans.

Though Microsoft provides a good deal of information including plan comparisons, it’s not as easy to understand as we think especially when multiple products are involved.

Following is a link which I came across and seems to be a good one to understand what is included and what is not under one single location.

https://www.infusedinnovations.com/blog/secure-modern-workplace/complete-office-365-and-microsoft-365-licensing-comparison

Finding OneDrive for Business space usage using PowerShell

Microsoft OneDrive for Business Logo One of the SharePoint Online administrator of the customer I work with wanted to know the space used by a business user’s private OneDrive.

The following PowerShell script helps to know the exact same information.

The script assumes that you have the SharePoint administrator role in your tenant.

To run this script “SharePoint Online Management Shell” PowerShell module should have been installed

Make sure you update the variables $tenantName & $url

Please note that the below scripts use minimal error handling for simplicity and clean code.

Script for single URL

Clear-Host
 
$tenantName = "tenant name"
$url = "https://unit4-my.sharepoint.com/personal/<user one drive url>"
 
Connect-SPOService -Url "https://$tenantName-admin.sharepoint.com"
 
$sc = Get-SPOSite $url -Detailed -ErrorAction SilentlyContinue | Select-Object url, storageusagecurrent, Owner 
$usage = [math]::round(($sc.StorageUsageCurrent/1024),2)
$owner = $sc.Owner
 
Write-Host "Site: $url"
Write-Host "Owner: $owner"
Write-Host "Usage: $usage GB"
 
Disconnect-SPOService

The following script helps to do the same for multiple URLs. All you need is a text file with OneDrive URL per line and it will provide output in a csv file.

Script for multiple URLs

$inputFileName = "OneDrive-Usage-URLs.txt"
$outputFileName = "OneDrive-Usage-URLs.csv"

Clear-Host
$tenantName = "tenant name"

Connect-SPOService -Url "https://$tenantName-admin.sharepoint.com"
$inputFile = Get-Content -Path .\$inputFileName
Add-Content .\$outputFileName -Value "URL,Owner,Usage (GB)"

foreach ($url in $inputFile) {
    $sc = Get-SPOSite $url -Detailed -ErrorAction SilentlyContinue | Select-Object url, storageusagecurrent, Owner
    $usage = [math]::round(($sc.StorageUsageCurrent / 1024), 2)
    $owner = $sc.Owner
    Add-Content .\$outputFileName -Value "$url,$owner,$usage"
    Write-Host "Site: $url"
    Write-Host "Owner: $owner"
    Write-Host "Usage: $usage GB"
    Write-Host ""
}

Disconnect-SPOService

Input file format (OneDrive-Usage-URLs.txt)

https://tenant-my.sharepoint.com/personal/user1_tenant_com
https://tenant-my.sharepoint.com/personal/user2_tenant_com

Output file format (OneDrive-Usage-URLs.csv)

URL,Owner,Usage (GB)
https://tenant-my.sharepoint.com/personal/user1_tenant_com,user1@tenant.com,123.45
https://unit4-my.sharepoint.com/personal/user2_tenant_com,user2@tenant.com,678.90