Description
The script mentioned in the below link to export all the power automate flows from the environment is not working
https://pnp.github.io/cli-microsoft365/sample-scripts/flow/export-all-flows-in-environment/
Error screen shot attached.
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.


Steps to reproduce
Login to the environment and then run the below script, you will get the error as below
PS C:\Users> Write-Output "Getting environment info..."
$environment = m365 flow environment list --query '[?contains(displayName,default)] .name'
Write-Output "Getting Flows info..."
$flows = m365 flow list --environment $environment --asAdmin --output json | ConvertFrom-JSON
Getting environment info...
Getting Flows info...
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Expected results
The script is expected to get the environment and flow details without any errors.
Actual results
PS C:\Users\ham> Write-Output "Getting environment info..."
$environment = m365 flow environment list --query '[?contains(displayName,default)] .name'
Write-Output "Getting Flows info..."
$flows = m365 flow list --environment $environment --asAdmin --output json | ConvertFrom-JSON
Getting environment info...
Getting Flows info...
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Diagnostics
No response
CLI for Microsoft 365 version
"v4.1.0"
nodejs version
v16.13.0
Operating system (environment)
Windows
Shell
Windows PowerShell
cli doctor
{
"os": {
"platform": "win32",
"version": "Windows 10 Enterprise",
"release": "10.0.19043"
},
"cliVersion": "4.1.0",
"nodeVersion": "v16.13.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "Browser",
"cliEnvironment": "",
"roles": [],
"scopes": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"ChannelMember.ReadWrite.All",
"ChannelMessage.Read.All",
"ChannelMessage.Send",
"ChannelSettings.ReadWrite.All",
"Directory.AccessAsUser.All",
"Directory.ReadWrite.All",
"Group.ReadWrite.All",
"IdentityProvider.ReadWrite.All",
"Mail.ReadWrite",
"Mail.Send",
"Policy.Read.All",
"Reports.Read.All",
"ServiceMessage.Read.All",
"Tasks.ReadWrite",
"Team.Create",
"TeamMember.ReadWrite.All",
"TeamsApp.ReadWrite.All",
"TeamsAppInstallation.ReadWriteForUser",
"TeamSettings.ReadWrite.All",
"TeamsTab.ReadWrite.All",
"TermStore.ReadWrite.All",
"User.Invite.All",
"User.ReadWrite.All",
"profile",
"openid",
"email",
"user_impersonation"
]
}
Additional Info
No response
Description
The script mentioned in the below link to export all the power automate flows from the environment is not working
https://pnp.github.io/cli-microsoft365/sample-scripts/flow/export-all-flows-in-environment/
Error screen shot attached.
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Steps to reproduce
Login to the environment and then run the below script, you will get the error as below
PS C:\Users> Write-Output "Getting environment info..."
Getting environment info...
Getting Flows info...
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Expected results
The script is expected to get the environment and flow details without any errors.
Actual results
PS C:\Users\ham> Write-Output "Getting environment info..."
Getting environment info...
Getting Flows info...
Error: The provided environment name '[ Default-64afd979-3a89-4d99-b151-29ce686c437f ]' has these invalid characters [ ]. The name can only be a letter, digit, '-', '.', '(', ')' or '_'.
Diagnostics
No response
CLI for Microsoft 365 version
"v4.1.0"
nodejs version
v16.13.0
Operating system (environment)
Windows
Shell
Windows PowerShell
cli doctor
{
"os": {
"platform": "win32",
"version": "Windows 10 Enterprise",
"release": "10.0.19043"
},
"cliVersion": "4.1.0",
"nodeVersion": "v16.13.0",
"cliAadAppId": "31359c7f-bd7e-475c-86db-fdb8c937548e",
"cliAadAppTenant": "common",
"authMode": "Browser",
"cliEnvironment": "",
"roles": [],
"scopes": [
"AllSites.FullControl",
"AppCatalog.ReadWrite.All",
"ChannelMember.ReadWrite.All",
"ChannelMessage.Read.All",
"ChannelMessage.Send",
"ChannelSettings.ReadWrite.All",
"Directory.AccessAsUser.All",
"Directory.ReadWrite.All",
"Group.ReadWrite.All",
"IdentityProvider.ReadWrite.All",
"Mail.ReadWrite",
"Mail.Send",
"Policy.Read.All",
"Reports.Read.All",
"ServiceMessage.Read.All",
"Tasks.ReadWrite",
"Team.Create",
"TeamMember.ReadWrite.All",
"TeamsApp.ReadWrite.All",
"TeamsAppInstallation.ReadWriteForUser",
"TeamSettings.ReadWrite.All",
"TeamsTab.ReadWrite.All",
"TermStore.ReadWrite.All",
"User.Invite.All",
"User.ReadWrite.All",
"profile",
"openid",
"email",
"user_impersonation"
]
}
Additional Info
No response