Dear All
I've been asked to report on our Power Pages Sites detailing in particular the 'Security' settings (certificate/ website authentication key expiration dates etc.)
Is this something that can be done programatically? is there an API that i can use to query such information?
Many thanks for your time and consideration
Ed.
Many thanks @chuhailinh
Generating a token and sending it to https://api.powerplatform.com/powerpages/environments/{environmentId}/websites?api-version=2022-03-01-preview did indeed result in some information regarding the website being sent back!!.... but sadly not the piece of information i wanted 😢
I was specifically after the expiration date of the 'Website Authentication Key' and similar details relating to any SSL certificates assigned.
Again, Many thanks
you should use these apis https://learn.microsoft.com/en-us/rest/api/power-platform/powerpages/websites with the token from the document that Fubar sent. apis in this document have same actions with yours but not enough fields
Hi @Fubar
Good News! With the help of that article you provided, i'm able to generate a bearer token using my azure app.
Bad News... when i use that bearer token to query the endpoints (for example:
"Message": "Authorization has been denied for this request."
I'm assuming my app doesn't have the correct permissions set out in the 'scp:' of the bearer token. Does anyone know what api permissions my app needs to be able to query the portals and powerpages?
In an attempt to get it working, i set the following api permissions on the app:
Sadly, those permissions don't seem enough 😞
Many thanks for your input @Fubar I'll take a look and see if i can make it work using the info
With much appreciation,
MonkeySee
Hi @Fubar , I tried it with this api https://learn.microsoft.com/en-us/rest/api/power-platform/powerpages/websites/get-website-by-id, but when I used service principal flow to get access token the api will not work, it is only work when I used user name password flow to get access token. I am not sure the reason is this Note. Do you know the real reason?
Don't know if this helps, but it is how you would get the token for other apps https://learn.microsoft.com/en-us/power-platform/admin/programmability-authentication-v2#step-5-request-an-access-token
Hi @MonkeySee , thank you for your answer
I see that for each geo location, the url is differrent, do you know how to get the mapping for geo and url
Hi chuhailinh,
No i don't have any documentation.
I've had to work it out for myself by capturing the web traffic generated when i visit the powerplatform admin center
regards,
Hi @MonkeySee , do you have any document about this api, because I see that, seems this api url depends on the geo localtion like 'gbr' in your code snippet
Hello Everyone
Just an update as to how I'm progressing this.
I've managed to cobble together quite a few PowerShell functions that get all the information I require from https://admin.powerplatform.microsoft.com
For example:
function Get-Portal {
[CmdletBinding()]
param (
[Parameter(Position=0,mandatory=$true)]
[string] $bearerToken
)
$headers = @{
'Authorization' = "Bearer $bearerToken"
}
$uri = "https://portalsitewide-gbr.portal-infra.dynamics.com/api/v1/powerPortal/ListPortals"
$result = Invoke-RestMethod -Method Get -Uri $uri -Headers $headers
return $result | ConvertFrom-Json
}
I'm just struggling with the Authorization Bearer token. Currently, I'm capturing it from my manually initiated web session and its working fine. I just want to be able to programmatically 'get' the authorization bearer token rather then the fudged solution I'm currently using.
If anyone has any ideas or resources that might help I'd be very grateful
kind regards
Fubar
69
Super User 2025 Season 1
oliver.rodrigues
49
Most Valuable Professional
Jon Unzueta
43