Forum Discussion
clone tiles errors
I don't reproduce your issue. After calling the REST API Clone tile, I got the targetUrl instead of null. However I'm still finding some issues about the API.
In your case, "reports/xxxxxx-xx-xx- some reportid" is a related path so when such report doesn't exists in the target workspace, the link doesn't work after cloned. And, unfortunately, as you mentioned, the clone API doesn't support specifying a new target URL. A workaround may be using a external link pointing to the original link, however this workaround won't work if the orginal/target workspaces are for isolated users.
By the way, the duplicate workspace looks more a workaround than solution in my opinion. There might be more limitations that those has been listed.
For more requests, you can submit them at Power BI Ideas and vote it up.
- MarianoCatalano8 years agoAdvocate I
Hi,
I have a script that clones reports, dashboards and tiles into a different workspace.
Reports and dashboards are cloned correctly.
When cloning tiles, I get the following error:
System.Net.WebException: The remote server returned an error: (401) Unauthorized.
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.GetResponse(WebRequest request)
at Microsoft.PowerShell.Commands.WebRequestPSCmdlet.ProcessRecord()function GetAuthToken
{
$adal = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\4.5.0\Microsoft.IdentityModel.Clients.ActiveDirectory.dll"
$adalforms = "${env:ProgramFiles}\WindowsPowerShell\Modules\AzureRM.profile\4.5.0\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll"
[System.Reflection.Assembly]::LoadFrom($adal) | Out-Null[System.Reflection.Assembly]::LoadFrom($adalforms) | Out-Null
$redirectUri = "urn:ietf:wg:oauth:2.0:oob"
$resourceAppIdURI = "https://analysis.windows.net/powerbi/api"
$authority = "https://login.microsoftonline.com/common/oauth2/authorize";
$authContext = New-Object "Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext" -ArgumentList $authority
$authResult = $authContext.AcquireToken($resourceAppIdURI, $clientId, $redirectUri, "Auto")
return $authResult
}# PART 1: Authentication
# ==================================================================
$token = GetAuthToken# Building Rest API header with authorization token
$auth_header = @{
'Content-Type'='application/json'
'Authorization'=$token.CreateAuthorizationHeader()
}Please help!!!
- MarianoCatalano8 years agoAdvocate I
I was able to make it work!!
- Anonymous8 years agoNot applicable
Hi Mariano, can you share how you managed to make it work? I am also facing the same exact issue (unauthorised). Thanks!