-
Notifications
You must be signed in to change notification settings - Fork 3
Releases: AMSoftwareNL/crmpowershell
Dataverse Powershell Library v2.2.0.0
Issues & Changes
-
#37 Support Impersonation
-
#38 Deployment mandatory with Register-CrmPluginStep
-
#39 Add features for (Access) Teams
-
#40 Manage Roles and Privileges
-
#41 Add Application User
-
Update to latest supported framework and packages
- Microsoft.CrmSdk.XrmTooling.CoreAssembly 9.1.0.92
Impersonation
Use Use-CrmImpersonatedUser or Set-CrmSession -ImpersonatedUserId to set the UserId of the user to impersonate. This update the session context connection and applies to all following requests. Set to Guid.Empty to stop the impersonation.
Using the commands sets both the CallerId for the OrganizationService as the CallerAADObjectId for the Web API.
Register-CrmPluginStep: Deployment parameter
The parameter Deployment was mandatory on Register-CrmPluginStep. This is changed to optional with the default value Both, as this is the value most will use.
Teams features
New and updated Cmdlets to support the latest Dataverse feature for Teams. This includes manage Team Templates, manage Azure AD connected Teams, and add and remove users for record Teams.
New and Updated Cmdlets are:
- New-CrmTeam
- Remove-CrmTeam
- Set-CrmTeam
- Get-CrmTeamTemplate
- New-CrmTeamTemplate
- Remove-CrmTeamTemplate
- Set-CrmTeamTemplate
- Add-CrmRecordTeamUser
- Remove-CrmRecordTeamUser
Security & Privileges
The library now has support to manage security and privileges with the following Cmdlets:
- Get-CrmContentAccess
- Get-CrmPrincipalPrivileges
- Get-CrmRolePrivileges
- Remove-CrmRolePrivilege
- Set-CrmRole
- Set-CrmRolePrivilege
- Test-CrmUserPrivilege
The New-CrmRole and Set-CrmRole Cmdlets also have the Inheritance parameter.
Application User
And last but not least the New-CrmApplication cmdlet is added to add an Azure App Registration (SPN) as Application User in Dataverse. All you have to provide is the AppId/ClientId.
Assets 3
Dataverse Powershell Library v2.1.1.0
Issues & Changes
-
#26 Support Batch operations
-
#28 Get and Set Environment Variables
-
#30 Service Endpoint doesn't support Webhook and EventHub
-
#31 Support for Virtual Entities and custom data-sources
-
#33 Provide clear error info when connection fails (see also #32)
-
#34 Support new multi-table lookup
-
#35 Support Upsert
-
Update to latest supported framework and packages
- Microsoft.CrmSdk.XrmTooling.CoreAssembly 9.1.0.79
Polymorphic (Multi Table) Lookup
Add a Polymorphic Lookup the same way a normal lookup is added, just add the switch Polymorphic. Add one single relationship at a time. When the relationship/lookup is marked as Polymorphic The Lookup and Relationship are created if the Attribute doesn't exist. Else the Relationships is added to the exiting Lookup. In this case additional Attribute parameters are ignored.
Microsoft documentation: Use multi-table lookup columns
Add-CrmRelationship -Entity 'new_media' -ToEntity 'new_audio' -Name 'new_media_audio' -Polymorphic -AttributeName 'new_contentid' -AttributeDisplayName 'Content' -
Add-CrmRelationship -Entity 'new_media' -ToEntity 'new_video' -Name 'new_media_video' -Polymorphic -AttributeName 'new_contentid' -AttributeDisplayName 'Content'
Data Providers, Data Sources and Virtual Tables
Register Data Providers, and create Data Source Tables and Virtual Tables.
Microsoft documentation: Get started with virtual tables
$solution = New-CrmSolution -Name 'ams_virtual_data' -DisplayName 'Virtual Data' -Version '1.0.0.0' -Publisher $publisher -PassThru
Use-CrmSolution $solution
$plugin = Register-CrmPlugin -LiteralPath '.\DSPlugin.dll' -IsolationMode Sandbox -AssemblyLocation Database -PassThru
# Create the Data Source Virtual Table to hold the actual Data Sources (configurations)
New-CrmEntity -DataSource -Name 'ams_rssfeed' -DisplayName 'RSS Feed Data Source' -DisplayCollectionName 'RSS Feed Data Sources' -AttributeName 'ams_name' -AttributeDisplayName 'Name' -AttributeExternalName 'name' -AttributeRequired Required -PassThru
Add-CrmStringAttribute -Entity 'ams_rssfeed' -Name 'ams_feeduri' -Format Url -Length 250 -DisplayName 'Feed URI' -Required Required -ExternalName 'feeduri'
Add-CrmStringAttribute -Entity 'ams_rssfeed' -Name 'ams_feedkey' -Format Url -Length 25 -DisplayName 'Feed Key' -Required Required -ExternalName 'feedkey' -IsDataSourceSecret
# Add a Data Source Configuration. The ID is needed for creation of the Virtual Table
$feedconfig = Add-CrmContent -Entity 'ams_rssfeed' -Attributes @{ams_name='Microsoft Power Platform Blog';ams_feeduri='https://cloudblogs.microsoft.com/powerplatform/feed/';ams_feedkey='secret'} -PassThru
# Register the Data Provider with the Data Source
$dataprovider = Register-CrmDataProvider -Name 'RSS Feed Data Provider' -DataSourceLogicalName 'ams_rssfeed' -RetrievePlugin $plugin -RetrieveMultiplePlugin $plugin -CreatePlugin $plugin -UpdatePlugin $plugin -DeletePlugin $plugin -PassThru
# Create the Virtual Table to hold the 'Microsoft Power Platform Blog' feed
New-CrmEntity -Virtual -Name 'ams_powerplatformblogfeed' -DisplayName 'Microsoft Power Platform Blog' -DisplayCollectionName 'Microsoft Power Platform Blogs' -ExternalName 'powerplatformblogfeed' -ExternalCollectionName 'powerplatformblogfeeds' -DataSourceConfiguration $feedconfig.ToEntityReference() -AttributeName 'ams_title' -AttributeDisplayName 'Title' -AttributeExternalName 'title' -AttributeRequired Required -AttributeLength 255 -HasNotes $true
Environment Variables
Define Environment Variables and set the Value.
Microsoft documentation: Environment variables overview
Service Endpoints, Webhooks and EventHub
Registration of Service Endpoints is updated to the latest configuration options, and now also supports registration for Azure EventHub.
The registration of WebHooks is added using Register_CrmWebHook
Microsoft Documentation:
Use WebHooks to create external handlers for server events
Work with Microsoft Dataverse event data in your Azure Event Hub solution
Upsert instead of just Add
On Add-Content include the Upsert switch to perform an Upsert instead of an Add.
Microsoft documentation: Use Upsert to insert or update a record
Batch support
For the more exotic scenarios simple batched operations can now be performed based on the ExecuteMultiple request and the ExecuteTransaction request. Only a simple batch is a supported. No nesting or multiple transaction, and the whole batch is a transaction or not.
Only the default content cmdlets can be include in a batch by adding the AsBatch switch.
- Add-CrmContent
- Get-CrmContent
- Join-CrmContent
- Remove-CrmContent
- Set-CrmContent
- Split-CrmContent
- Invoke-CrmRequest
Add-CrmContent -Entity 'account' -Attributes @{name='Account 1'} -AsBatch
Add-CrmContent -Entity 'account' -Attributes @{name='Account 2'} -AsBatch
Add-CrmContent -Entity 'account' -Attributes @{name='Account 3'} -AsBatch
Add-CrmContent -Entity 'account' -Attributes @{name='Account 4'} -AsBatch
Submit-CrmBatch -AsTransaction -ReturnResponses
Retrieve Data Performance
There was a major issue with the performance when getting data. Getting 50 rows of data took almost 30 seconds. This was due to a major issue in the EntityPropertyAdapter. This adapter does the flattening/pivoting of the Attributes-collection and FormattedValues-collection. For every row multiple calls to the Entity- and Attribute-metadata were performed. This is now solved by getting the metadata for the Entity and Attributes once and using this.
In addition the Metadata-cache was checked on every call to metadata. Now the cache is checked (and updated if needed) at the start of every cmdlet (in the BeginProcessing function), so during execution of the cmdlet the up-to-date cache is used, and no longer being checked or updated.
Fixes, Optimizations and Performance improvements
- Dynamic Parameters merged with normal cmdlet logic
No more use of Dynamic Parameters based on versions as this wasn't updated since Dynamics 2016. Dynamic Parameters were also not included in the docs. Now the docs are complete. - Removed VersionChecks
Version checks on cmdlets and parameters are removed. Every cmdlet is now always up-to-date with the latest version of Dataverse. It's up to the user to skip non supported cmdlets and parameters if using the library on-premises. - Fix on Get-CrmEntityKey
The Attributes parameter contained an incorrect ArgumentCompleter - Use PSBoundParameters to check provided values
Instead of using Nullable types and values to check if a parameter and value are provided, now we use the PSBoundParameters. As a result parameters are now no longer Nullable. If provided the values are used as-is. - Optimized cache use
Metadata cache is now used with all Entity related metadata cmdlets.
Cache initialization can be forced on Connect-CrmOrganization using the InitializeMetadataCache switch. Otherwise the cached is initialized on first use. - Get-CrmEntity with EntityTypeCode
- OrganizationRequest and -Response PropertyAdapters to flatten/pivot the Parameters and Results, like with Entity Attributes.
Assets 3
Dataverse Powershell Library v2.1.0.0
This release is pulled in favor of v2.1.1.0 as it contained an issue with the LogicalName and Id fields for records.
see also: #36
Assets 2
CRM Powershell Library v2.0.0.0
Issues & Changes
-
#24 Use Xrm.Tooling.CrmConnector from the SDK or the Powershell cmdlet to connect to Dynamics/Dataverse
-
#27 Mandatory OAuth2.0
-
#23 New-Command Get-CrmSPDocumentLocation (thanks to @RichieRoxx)
-
#25 Add Invoke-CrmWebApiRequest
-
Update to latest supported framework and packages
- .NET Framework 4.6.2
- Microsoft.CrmSdk.XrmTooling.CoreAssembly 9.1.0.68 including Microsoft.CrmSdk.CoreAssemblies 9.0.2.25
Modern Authentication
To support changes to the login and authentication of modern Power Platform Dataverse environements and Dynamics 365 environments (on-premises and online) the classic authentication mechanism (WS-Trust) is removed, and instead the connection is to an environment is based on CrmServiceClient.
This is not implemented in the module, but instead the module Microsoft.Xrm.Tooling.CrmConnector.PowerShell is utilized.
Connect via CrmServiceClient
$connection = Get-CrmConnection -InteractiveMode
Connect-CrmOrganization -Connection $connection