pac admin

Work with your Power Platform Admin Account

Commands

Command Description
pac admin assign-group Assign group to target Dataverse environment with specified security role.
pac admin assign-user Assign a user to a target Dataverse environment with specified security role.
pac admin backup Takes a manual backup of your environment.
pac admin copy Copy Source Environment to Destination Environment
pac admin create Creates a Dataverse database in your tenant.
pac admin create-service-principal Add AAD Application and SPN to Dynamics365 AAD and configure Dynamics365 to accept the SPN as tenant admin user.
pac admin delete Deletes Environment from your tenant
pac admin list List all environments from your tenant
pac admin list-app-templates Lists all supported Dataverse database templates of model-driven apps in Dynamics 365.
pac admin list-backups Lists all backups of your environment.
pac admin reset Reset environment from your tenant
pac admin restore Restores an environment to a given backup.
pac admin set-backup-retention-period Takes a manual backup of your environment.
pac admin status This command will list the status of all the operations in progress.

pac admin assign-group

Assign group to target Dataverse environment with specified security role.

Required Parameters

--environment -env

ID or URL of the environment to assign a user to.

--group -g

AAD object id of group to assign to target Dataverse environment.

--group-name -gn

Name of group/team that will be created in Dataverse.

--membership-type -mt

Team membership type.

Use one of these values:

  • MembersAndGuests
  • Members
  • Owners
  • Guests

--role -r

Name or ID of security role to be applied to user

--team-type -tt

Type of team.

Use one of these values:

  • Owner
  • Access
  • AadSecurityGroup
  • AadOfficeGroup

Optional Parameters

--business-unit -bu

ID of business unit to associate application user with.

pac admin assign-user

Assign a user to a target Dataverse environment with specified security role.

Examples

The following examples show the use of the pac admin assign-user command.

Assign a user by email to an environment with the basic user role

pac admin assign-user `
  --environment 00000000-0000-0000-0000-000000000000 `
  --user "user@company.com" `
  --role "Basic User"

Assign a user by guid to an environment with the system administrator role and add the user to a specified business unit

pac admin assign-user `
  --environment 00000000-0000-0000-0000-000000000000 `
  --user 00000000-0000-0000-0000-000000000000 `
  --business-unit` 00000000-0000-0000-0000-000000000000 `
  --role "System Administrator"

Assign an application user to an environment with the system administrator role

pac admin assign-user `
  --environment 00000000-0000-0000-0000-000000000000 `
  --user 00000000-0000-0000-0000-000000000000 `
  --role "System Administrator"
  --application-user

Required Parameters

--environment -env

ID or URL of the environment to assign a user to.

--role -r

Name or ID of security role to be applied to user

--user -u

Object ID or UPN of AAD user to be assigned to the environment or Application ID if assigning an Application User.

Optional Parameters

--application-user -au

Specifies whether the input user is an application user. If business unit is not specified the application user will be added to the authenticated users business unit.

This parameter requires no value. It is a switch.

--async -a

Deprecated: This parameter will be ignored.

--business-unit -bu

ID of business unit to associate application user with.

pac admin backup

Takes a manual backup of your environment.

Example

Create a manual backup for an environment

pac admin backup `
  --environment 00000000-0000-0000-0000-000000000000 `
  --label "Manual Backup October 2022"

Required Parameters

--label -l

Sets the backup label as provided.

Optional Parameters

--environment -env

Environment URL or ID of the Environment that requires backup.

--environment-id -id

Deprecated: Use --environment instead.

--notes -n

Deprecated: This parameter will be ignored.

--url -u

Deprecated: Use --environment instead.

pac admin copy

Copy Source Environment to Destination Environment

Examples

The following examples show the use of the pac admin copy command.

Copy an environment from a source environment to a target environment using a minimal copy

This example copies over customizations and schemas only from a source environment to a target environment.

pac admin copy `
  --name "Environment Name" `
  --source-env 00000000-0000-0000-0000-000000000000 `
  --target-env 00000000-0000-0000-0000-000000000000 `
  --type MinimalCopy

Copy an environment from a source environment to a target environment using a full copy

This example copies the whole environment over from a source environment to a target environment.

pac admin copy `
  --name "Environment Name" `
  --source-env 00000000-0000-0000-0000-000000000000 `
  --target-env 00000000-0000-0000-0000-000000000000 `
  --type FullCopy

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--name -n

Name of the target environment

--skip-audit-data -sa

Switch indicating whether audit data should be skipped

This parameter requires no value. It is a switch.

--source-env -se

Environment URL or ID of the source environment that is being copied

--source-id -si

Deprecated: Use --source-env instead.

--source-url -su

Deprecated: Use --source-env instead.

--target-env -te

Environment URL or ID of the target environment

--target-id -ti

Deprecated: Use --target-env instead.

--target-url -tu

Deprecated: Use --target-env instead.

--type -t

Use one of these values:

  • MinimalCopy
  • FullCopy

--json

Returns the output of the command as a JSON formatted string.

pac admin create

Creates a Dataverse database in your tenant.

Examples

The following examples show the use of the pac admin create command.

Simple creation of an environment

In this example, we'll create a sandbox environment with the default settings:

  • Currency: USD
  • Language: English
  • Region: unitedstates

We don't have to add those properties, because those values are the default values.

pac admin create `
  --name "Contoso Test" `
  --type Sandbox `
  --domain ContosoTest

Advanced creation of an environment

In this example, we'll create a production environment in the region europe, with the currency set to Euro and the language to English.

We don't have to add the language property, because it's the default value.

pac admin create `
  --name "Contoso Marketing" `
  --currency EUR `
  --region europe `
  --type Production `
  --domain ContosoMarketing

Required Parameters

--type -t

Sets the environment Type.

Use one of these values:

  • Trial
  • Sandbox
  • Production
  • Developer
  • Teams
  • SubscriptionBasedTrial

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--currency -c

Sets the currency used for your environment. [defaults to USD]

--domain -d

The domain name is part of the environment URL. If domain name is already in use, a numeric value will be appended to the domain name. Eg: If 'contoso' is already in use, then the environment URL will be updated to https://{contoso}0.crm.dynamics.com.

Note: Only characters within the ranges [A - Z], [a - z], [0 - 9], or '-' are allowed. The first and last character cannot be the '-' character. Consecutive '-' characters are not allowed.

--input-file -if

The verb arguments to be passed in a .json input file. Eg: {"name" : "contoso"}. The arguments passed through command-line will take precedence over arguments from the .json input file.

--language -l

Sets the language used for your environment. [defaults to English]

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--name -n

Sets the name of the environment.

--region -r

Sets the environment's region name. [defaults to unitedstates]

--team-id -tid

Team Id as Guid

Note: The Team Id must be a valid Guid.

--templates -tm

Sets Dynamics365 app that needs to be deployed. [passed as comma separated values] e.g : -tm "D365_Sample, D365_Sales"

--json

Returns the output of the command as a JSON formatted string.

pac admin create-service-principal

Add AAD Application and SPN to Dynamics365 AAD and configure Dynamics365 to accept the SPN as tenant admin user.

pac admin delete

Deletes Environment from your tenant

Examples

The following examples show the use of the pac admin delete command.

Delete environment by GUID

pac admin delete --environment 00000000-0000-0000-0000-000000000000

Delete environment by URL

pac admin delete --environment https://contosomarketing.crm4.dynamics.com

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--environment -env

Environment URL or ID of the Environment that needs to be deleted from your tenant.

--environment-id -id

Deprecated: Use --environment instead.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--url -u

Deprecated: Use --environment instead.

pac admin list

List all environments from your tenant

Examples

The following examples show the use of the pac admin list command.

List all environments in the tenant

This example will list all environments in the tenant.

pac admin list

An example of the output is displayed below.

Environment   Environment Id                        Environment Url                        Type        Organization Id
Contoso       00000000-0000-0000-0000-000000000000  https://contoso.crm.dynamics.com/      Production  00000000-0000-0000-0000-000000000000
Contoso Dev   00000000-0000-0000-0000-000000000000  https://contoso-dev.crm.dynamics.com/  Sandbox     00000000-0000-0000-0000-000000000000
Contoso Test  00000000-0000-0000-0000-000000000000  https://commdemos.crm.dynamics.com/    Sandbox     00000000-0000-0000-0000-000000000000

List all sandbox environments in the tenant

This example will list all environments in the tenant of the type Sandbox.

pac admin list --type Sandbox

An example of the output is displayed below.

Environment  Environment Id                        Environment Url                        Type        Organization Id
Contoso Dev  00000000-0000-0000-0000-000000000000  https://contoso-dev.crm.dynamics.com/  Sandbox     00000000-0000-0000-0000-000000000000
Contoso Test 00000000-0000-0000-0000-000000000000  https://commdemos.crm.dynamics.com/    Sandbox     00000000-0000-0000-0000-000000000000

Optional Parameters

--application -a

List all environments that have specified application installed. To specify application, use unique name or id.

--environment -env

List all environments that contain given string in their name or id.

--environment-id -id

Deprecated: Use --environment instead.

--name -n

List all environments that contain given string in their name.

--organization-id -oi

List all environments that contain given string in their organization id.

--type -t

List all environments with the given type.

Use one of these values:

  • Trial
  • Sandbox
  • Production
  • Developer
  • Teams
  • SubscriptionBasedTrial

--url -u

Deprecated: Use --environment instead.

--json

Returns the output of the command as a JSON formatted string.

pac admin list-app-templates

Lists all supported Dataverse database templates of model-driven apps in Dynamics 365.

Examples

The following examples use the pac admin list-app-templates command:

List all supported Dataverse database templates

This example lists all supported Dataverse database templates of model-driven apps in Dynamics 365.

pac admin list-app-templates

An example of the output is displayed below.

Template Name               Template Location Template Display Name Is Disabled
D365_CDSSampleApp           unitedstates      Sample App            False
D365_CustomerService        unitedstates      Customer Service      True
D365_CustomerServicePro     unitedstates      Customer Service Pro  True
D365_DeveloperEdition       unitedstates      Developer Edition     False
D365_FieldService           unitedstates      Field Service         True
D365_Guides                 unitedstates      Guides                True
D365_PowerFrameworkTemplate unitedstates      Power Framework       False
D365_ProjectOperations      unitedstates      Project Operations    True
D365_RemoteAssist           unitedstates      Remote Assist         True
D365_Sales                  unitedstates      Sales Enterprise      True
D365_SalesPro               unitedstates      Sales Pro             True
D365_SmbMarketing           unitedstates      SMB Marketing         True

List all supported Dataverse database templates of model-driven apps in Dynamics 365 for region Europe

This example lists all supported Dataverse database templates of model-driven apps in Dynamics 365 for the region Europe.

pac admin list-app-templates --region Europe

An example of the output is displayed below.

Template Name               Template Location Template Display Name Is Disabled
D365_CDSSampleApp           Europe            Sample App            False
D365_CustomerService        Europe            Customer Service      True
D365_CustomerServicePro     Europe            Customer Service Pro  True
D365_DeveloperEdition       Europe            Developer Edition     True
D365_FieldService           Europe            Field Service         True
D365_Guides                 Europe            Guides                True
D365_PowerFrameworkTemplate Europe            Power Framework       True
D365_ProjectOperations      Europe            Project Operations    True
D365_RemoteAssist           Europe            Remote Assist         True
D365_Sales                  Europe            Sales Enterprise      True
D365_SalesPro               Europe            Sales Pro             True
D365_SmbMarketing           Europe            SMB Marketing         True

Optional Parameters

--region -r

Sets the environment's region name. [defaults to unitedstates]

pac admin list-backups

Lists all backups of your environment.

Examples

The following examples show the use of the pac admin list-backups command.

List backups from an environment by ID

This example lists the backups of an environment based on the environment ID.

pac admin list-backups --environment 00000000-0000-0000-0000-000000000000

An example of the output is displayed below.

 Index   Id                                      Label        Expiry                Point Date
 1       00000000-0000-0000-0000-000000000000    Backup       14/12/2022 12:50:38   07/12/2022 12:50:38

List backups from an environment by URL

This example lists the backups of an environment based on the environment URL.

pac admin list-backups --environment https://contoso.crm.dynamics.com

Optional Parameters

--environment -env

List all environments that contains given string in their Environment ID or URL.

--environment-id -id

Deprecated: Use --environment instead.

--url -u

Deprecated: Use --environment instead.

pac admin reset

Reset environment from your tenant

Examples

The following examples show the use of the pac admin reset command:

Reset an environment in your tenant

pac admin reset --environment 00000000-0000-0000-0000-000000000000

Reset an environment in your tenant and set the currency to EUR

pac admin reset --environment 00000000-0000-0000-0000-000000000000 --currency EUR

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--currency -c

Sets the currency used for your environment. [defaults to USD]

--domain -d

The domain name is part of the environment URL. If domain name is already in use, a numeric value will be appended to the domain name. Eg: If 'contoso' is already in use, then the environment URL will be updated to https://{contoso}0.crm.dynamics.com.

--environment -env

URL or ID of the Environment that needs to be reset.

--environment-id -id

Deprecated: Use --environment instead.

--input-file -if

The verb arguments to be passed in a .json input file. Eg: {"name" : "contoso"}. The arguments passed through command-line will take precedence over arguments from the .json input file.

--language -l

Sets the language used for your environment. [defaults to English]

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--name -n

Sets the name of the environment.

--purpose -p

Sets the description used to associate the environment with a specific intent.

--templates -tm

Sets Dynamics365 app that needs to be deployed. [passed as comma separated values] e.g : -tm "D365_Sample, D365_Sales"

--url -u

Deprecated: Use --environment instead.

--json

Returns the output of the command as a JSON formatted string.

pac admin restore

Restores an environment to a given backup.

Examples

The following examples show the use of the pac admin restore command:

Restore the latest backup

This example restores the latest backup from the source environment with ID 00000000-0000-0000-0000-000000000000 to the environment that's currently selected in the currently active auth profile.

pac admin restore --selected-backup latest --source-env 00000000-0000-0000-0000-000000000000

Restore a backup based on a timestamp

This example restores the backup that has been created on 12/01/2022 09:00 from the source environment with ID 00000000-0000-0000-0000-000000000000 to the environment that's currently selected in the currently active auth profile.

pac admin restore --selected-backup '12/01/2022 09:00' --source-env 00000000-0000-0000-0000-000000000000

Required Parameters

--selected-backup -sb

DateTime of the backup in 'mm/dd/yyyy hh:mm' format OR string 'latest'.

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--name -n

Optional name of the restored environment.

--skip-audit-data -sa

Switch indicating whether audit data should be skipped

This parameter requires no value. It is a switch.

--source-env -se

Environment URL or ID of the source environment required for restore.

--source-id -si

Deprecated: Use --source-env instead.

--source-url -su

Deprecated: Use --source-env instead.

--target-env -te

Environment URL or ID of the target environment required for restore. This would default to source URL/ID if not provided.

--target-id -ti

Deprecated: Use --target-env instead.

--target-url -tu

Deprecated: Use --target-env instead.

--json

Returns the output of the command as a JSON formatted string.

pac admin set-backup-retention-period

Takes a manual backup of your environment.

Required Parameters

--backup-retention-period -br

Sets the backup retention period in days as provided. Valid values are: 7, 14, 21, 28.

Optional Parameters

--async -a

Optional boolean argument to run pac verbs asynchronously, defaults to false.

This parameter requires no value. It is a switch.

--environment -env

Environment URL or ID of the Environment that requires backup.

--environment-id -id

Deprecated: Use --environment instead.

--max-async-wait-time -wt

Max asynchronous wait time in minutes. Default value is 60 minutes

--url -u

Deprecated: Use --environment instead.

pac admin status

This command will list the status of all the operations in progress.

See also

Microsoft Power Platform CLI Command Groups
Microsoft Power Platform CLI overview