Open IkramullahQuraishi opened 2 weeks ago
Thank you for logging this issue. Seems like the command is still working on my tenant. In which region is your tenant located?
Could you run m365 cli doctor
and paste the output here?
Additionally, you can append --debug
to your command to see what's going on exactly. Could be useful if we can see that as well.
My tenant is in Spain region. the output of m365 cli doctor is as below:
{
"os": {
"platform": "win32",
"version": "Windows 11 Pro",
"release": "10.0.22000"
},
"cliVersion": "7.9.0",
"nodeVersion": "v20.10.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "DeviceCode",
"cliEnvironment": "",
"cliConfig": {},
"roles": [],
"scopes": {
"https://graph.microsoft.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"ChannelMember.ReadWrite.All",
"ChannelMessage.Read.All",
"ChannelMessage.Send",
"ChannelSettings.ReadWrite.All",
"Chat.Read",
"Chat.ReadWrite",
"Directory.AccessAsUser.All",
"Directory.ReadWrite.All",
"ExternalConnection.ReadWrite.All",
"Group.ReadWrite.All",
"IdentityProvider.ReadWrite.All",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"Place.Read.All",
"Policy.Read.All",
"Reports.Read.All",
"SecurityEvents.Read.All",
"ServiceHealth.Read.All",
"ServiceMessage.Read.All",
"ServiceMessageViewpoint.Write",
"Tasks.ReadWrite",
"Team.Create",
"TeamMember.ReadWrite.All",
"TeamsAppInstallation.ReadWriteForUser",
"TeamSettings.ReadWrite.All",
"TeamsTab.ReadWrite.All",
"TermStore.ReadWrite.All",
"User.Invite.All",
"User.ReadWrite.All",
"profile",
"openid",
"email"
],
"https://management.azure.com/": [
"user_impersonation"
],
"https://unitednations.sharepoint.com": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"AuditLog.Read.All",
"Bookings.Read.All",
"ChannelMember.ReadWrite.All",
"ChannelMessage.Read.All",
"ChannelMessage.Send",
"ChannelSettings.ReadWrite.All",
"Chat.Read",
"Chat.ReadWrite",
"Directory.AccessAsUser.All",
"Directory.ReadWrite.All",
"ExternalConnection.ReadWrite.All",
"Group.ReadWrite.All",
"IdentityProvider.ReadWrite.All",
"Mail.ReadWrite",
"Mail.Send",
"Notes.Read.All",
"Place.Read.All",
"Policy.Read.All",
"Reports.Read.All",
"SecurityEvents.Read.All",
"ServiceHealth.Read.All",
"ServiceMessage.Read.All",
"ServiceMessageViewpoint.Write",
"Tasks.ReadWrite",
"Team.Create",
"TeamMember.ReadWrite.All",
"TeamsAppInstallation.ReadWriteForUser",
"TeamSettings.ReadWrite.All",
"TeamsTab.ReadWrite.All",
"TermStore.ReadWrite.All",
"User.Invite.All",
"User.ReadWrite.All"
]
}
}
@milanholemans Any update on the issue please?
Hi @IkramullahQuraishi, sorry for the late reply. Being quite busy the last couple of days. It's annoying that I cannot seem to reproduce your issue. Additionally, can't find much info about this error listing Power Automate flow runs. Is the command m365 flow list
failing for you with the same error?
@IkramullahQuraishi is the flow run overview in the Power Automate UI still working for you? When you visit the page with all your PA flows, could you see in your network inspector which API request is made? The request should contain the word /runs
.
Hi @IkramullahQuraishi, sorry for the late reply. Being quite busy the last couple of days. It's annoying that I cannot seem to reproduce your issue. Additionally, can't find much info about this error listing Power Automate flow runs. Is the command
m365 flow list
failing for you with the same error?
Thanks for the response. I'm eagerly waiting for a fix. Recently, the List Flow as Admin connector has started throwing errors, even in Power Automate (PA) flows, and is prompting me to use version 2 (V2) of the connector. However, Microsoft has deprecated this connector, and I believe that m365 is still referencing the outdated connector, which is causing the error.
@milanholemans Please see my complete script below:
m365 login
$environment = 'f98ac0a3-5cd6-48b6-bde4-045ec949120c'
$csvFile = 'C:\\Users\\FlowRunsFiles\\FlowData.csv' # change this to the path and name of your csv file
$flows = m365 flow list --environmentName $environment --query '[].{name: name, displayName: properties.displayName,owner: properties.creator.userId, state: properties.state, created: properties.createdTime, lastModified: properties.lastModifiedTime, trigger: properties.definitionSummary.triggers[0].swaggerOperationId, triggerType: properties.definitionSummary.triggers[0].type }' --asAdmin --output json
$flows = $flows | ConvertFrom-Json
$currentDayDate = (Get-Date).ToUniversalTime().ToString("o")
$previousDayDate = (Get-Date).AddDays(-1).ToUniversalTime().ToString("o")
$uniqueOwners = $flows.owner | Sort-Object | Get-Unique
$userMap = @{}
$uniqueOwners | ForEach-Object {
m365 aad user get --id $_ --output json | ConvertFrom-Json
} | ForEach-Object {
$userMap.Add($_.id, @{
upn = $_.userPrincipalName
displayName = $_.displayName
mail = $_.mail
}
)
}
$flows | ForEach-Object {
$_ | Add-Member -MemberType NoteProperty -Name "upn" -Value $userMap[$_.owner].upn
$_ | Add-Member -MemberType NoteProperty -Name "ownerName" -Value $userMap[$_.owner].displayName
$_ | Add-Member -MemberType NoteProperty -Name "ownerMail" -Value $userMap[$_.owner].mail
}
$flowData = @() # create an empty array to store the custom objects
foreach ($flow in $flows)
{
#$todayRuns = m365 flow run list --environmentName $environment --flowName $flow.name --triggerStartTime $previousDayDate --triggerEndTime $currentDayDate --output json | ConvertFrom-Json
$todayRuns = m365 flow run list --environmentName $environment --flowName $flow.name --status Failed --triggerStartTime $previousDayDate --triggerEndTime $currentDayDate --asAdmin --output json | ConvertFrom-Json
$displayName = $flow.displayName
$id = $flow.name
$CreatedBy= $flow.ownerName
$createdByEmail= $flow.ownerMail
$todayRunsCount = 0
$todaySuccessRunsCount = 0
$todayFailedRunsCount = 0
if($todayRuns.Count -gt 0)
{
$todayRunsCount = $todayRuns.Count
}
# create a custom object with the properties you want to export
$flowObject = [pscustomobject]@{
DisplayName = $displayName
Id = $id
CreatedBy= $CreatedBy
CreatedByEmail = $createdByEmail
#Runs = $todayRunsCount
#Succeeded = $todaySuccessRunsCount
FailedRuns = $todayRunsCount
}
# add the custom object to the array
$flowData += $flowObject
}
# export the array to the csv file
$flowData | Export-Csv -Path $csvFile -NoTypeInformation
Write-host 'upload files and folders from directory example'
function Import-FilesAndFolders(
[Parameter(Mandatory = $True)][string] $folderPath,
[Parameter(Mandatory = $True)][string] $sPFolderPath,
[Parameter(Mandatory = $True)][string] $siteUrl) {
$items = Get-ChildItem -Path $folderPath
foreach ($item in $items) {
if ((Get-Item $item.FullName) -is [System.IO.DirectoryInfo]) {
Write-host "creating folder $item"
$folderCreated = m365 spo folder add --webUrl $siteUrl --parentFolderUrl $sPFolderPath --name $item.Name
Write-host "importing folder $item"
Import-FilesAndFolders -folderPath $item.FullName -sPFolderPath "$sPFolderPath/$($item.Name)" -siteUrl $siteUrl
}
else {
Write-host "importing file $item"
m365 spo file add --webUrl $siteUrl --folder $sPFolderPath --path $item.FullName
}
}
}
$importFolderPath = 'C:\\Users\\FlowRunsFiles'
$sPFolderPath = '/Shared Documents/FlowRuns'
$siteUrl = 'https://contoso.sharepoint.com/sites/PowerPlatform'
Import-FilesAndFolders -folderPath $importFolderPath -sPFolderPath $sPFolderPath -siteUrl $siteUrl
Hi @IkramullahQuraishi, sorry for the late reply. Being quite busy the last couple of days. It's annoying that I cannot seem to reproduce your issue. Additionally, can't find much info about this error listing Power Automate flow runs. Is the command
m365 flow list
failing for you with the same error?
It is List Flow as admin which is causing the issue
@IkramullahQuraishi thank you for additional info 👍. You Rock 🤩 We are investigating the issue 👍
Priority
(Urgent) I can't use the CLI
Description
I am using the m365 flow list as admin and now it has started giving me the below error: Error: The List Flows as Admin API is no longer supported. Please use the List Flows as Admin (V2) API.
Steps to reproduce
By running the below powershell script: $todayRuns = m365 flow run list --environmentName $environment --flowName $flow.name --status Failed --triggerStartTime $previousDayDate --triggerEndTime $currentDayDate --asAdmin --output json | ConvertFrom-Json
Expected results
I think the V2 of the List Flows as Admin connector should be used in the code.
Actual results
Giving error on execution the powershell script.
Diagnostics
No response
CLI for Microsoft 365 version
v7.0.0
nodejs version
v20.10.0
Operating system (environment)
Windows
Shell
Windows PowerShell
cli doctor
No response
Additional Info
No response