Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Admins can take inventory of scheduled prompts created in their organization by running PowerShell scripts. The following instructions enable admins to connect to their accounts and view, list, or delete scheduled prompts.
Prerequisites
To take inventory of scheduled prompts created by users in your organization, you need the following prerequisites:
- Have the Global Administrator and Power Platform Administrator roles assigned to your user in Azure portal for the tenant on which you want to do operations.
- Use PowerShell v7.0+.
- Have
Az.Accounts
andMicrosoft.PowerApps.Administration.PowerShell
modules installed. - Have all scripts in the same folder and run the scripts while being in that folder.
To get the System Administrator role on the Copilot scheduled prompts environment, follow these steps:
- Go to Power Platform admin center.
- Find the Microsoft 365 environment and select it. (This is the default name for Copilot Actions environment; some tenants might use a different name).
- Select Membership.
- Select Add me to add the System Administrator role to your user. It might take around 30 minutes for the role to be reflected everywhere.
More details and options, see Manage High-Privileged Admin Roles.
Connect to your Azure Account
Before running any of the following scripts, you must sign in to your administrator account. To sign in, run the following script:
Connect-AzAccount
General operations
- To get the environment name for Copilot scheduled prompts, run the following script and connect with the admin account if requested:
Get-AdminPowerAppEnvironment 'Microsoft 365'
Enter your display name (Microsoft 365
by default). Note the EnvironmentName
value indicates your environment name.
- You can also identify a user ID by running this script, using the appropriate user email (user@domain.com in the following example). Note the
Id
field value in the output and that indicate the user’s ID:
Connect-Entra
Get-EntraUser -UserId 'user@domain.com'
List Copilot scheduled prompts
There are different ways to run a script to list scheduled prompts created in your tenant.
Get a list of Copilot scheduled prompts for the whole tenant
Get the
EnvironmentId
using the script provided earlier.Run the following script, replacing the placeholder with your actual
EnvironmentId
, and connect with the admin account if prompted:.\Get-CopilotActions.ps1 -EnvironmentId abc123-a100-xyz000-12345
The list of Copilot scheduled prompts should display in the console.
Get a list of Copilot scheduled prompts for a single user
Get the
EnvironmentId
andUserId
using the scripts provided earlier.Run the following script using the appropriate
EnvironmentId
andUserId
to replace the placeholders and connecting with admin account if requested:.\Get-CopilotActions.ps1 -EnvironmentId abc123-a100-xyz000-12345 -UserId abc123-a100-xyz000-12345
The list of Copilot scheduled prompts belonging to that user should display in the console.
Export the list to an Excel/CSV file
Add the following to the end of the command:
| Export-Csv -Path C:\temp\resultFile.csv
Example:
.\Get-CopilotActions.ps1 -EnvironmentId abc123-a100-xyz000-12345 | Export-Csv -Path C:\temp\resultFile.csv
Delete Copilot scheduled prompts
Delete a single Copilot Action
Get the
EnvironmentId
and theDataverseId
of the action you wish to delete.Run the following script:
.\Remove-CopilotAction.ps1 -EnvironmentId abc123-a100-xyz000-12345 -DataverseId abc123-a100-xyz000-12345
Delete multiple Copilot Scheduled Prompts from a single user
Complete Getting the Copilot Scheduled Prompts environment ID.
Complete Getting the Microsoft Entra user object ID.
Run the following script using the appropriate
EnvironmentId
andUserId
and connecting with admin account if requested:.\Clear-CopilotActions.ps1 -EnvironmentId abc123-a100-xyz000-12345 -UserId abc123-a100-xyz000-12345