Applies to Product - Microsoft Dataverse
What’s happening?
Customers are seeking a way to automate the creation of Teams within Dynamics 365 using PowerShell scripts.
Reason:
The specific PowerShell cmdlet for creating Teams in Dynamics 365 is not available, leading to confusion regarding the correct commands to use.
Resolution:
To create a new team in Dynamics CRM using PowerShell, follow these steps:
- Install the PowerShell Module:
- Open PowerShell as an administrator and run: Install-Module -Name Microsoft.Xrm.Tooling.CrmConnector.PowerShell
- Connect to Dynamics CRM:
- Use the following command to connect to your Dynamics CRM instance: powershell $Cred = Get-Credential $CRMConn = Get-CrmConnection -Credential $Cred -DeploymentRegion NorthAmerica -Online
- Create a New Team:
- Use the New-CrmTeam cmdlet to create a new team: powershell New-CrmTeam -Connection $CRMConn -Name "New Team Name" -BusinessUnitId "Business Unit ID"
- Replace "New Team Name" with the desired name for your team and "Business Unit ID" with the ID of the business unit to which the team belongs.
- Assign Security Roles:
- If you need to assign security roles to the team after creation, you can use the following command: powershell # Example command to assign a security role to a team Assign-SecurityRoleToTeam -Connection $CRMConn -TeamId "Team ID" -SecurityRoleId "Security Role ID"
- API Alternative:
- If the above method does not work, you can create the new team via an API call and then use the team’s name to assign any role.
