src/Instances/New-XrmInstance.ps1
|
<# .SYNOPSIS Initialize new object that represent a Xrm Instance. .DESCRIPTION Build an empty instance object, as filled by Get-XrmInstances from the Power Platform environments: Id, Name (domain name), UniqueName, DisplayName, Url, ApiUrl, Location, DataCenter, Sku, Type, Version, BaseLanguage, State, CreationTemplates, ConnectionString and ParentConnection. Nothing is created in Power Platform: use Add-XrmInstance to provision an environment. .OUTPUTS PSCustomObject. Instance object with empty values. .EXAMPLE $instance = New-XrmInstance; $instance.DisplayName = "Contoso Dev"; $instance.Url = "https://contoso-dev.crm4.dynamics.com"; $connectionString = $instance | Out-XrmConnectionString; .LINK https://github.com/AymericM78/PowerDataOps/blob/main/documentation/commands/New-XrmInstance.md #> function New-XrmInstance { [CmdletBinding()] [OutputType([PSCustomObject])] param ( ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); } process { $hash = @{}; $hash["Id"] = [Guid]::Empty; $hash["Name"] = [String]::Empty; $hash["UniqueName"] = [String]::Empty; $hash["DisplayName"] = [String]::Empty; $hash["Url"] = [String]::Empty; $hash["ApiUrl"] = [String]::Empty; $hash["Location"] = [String]::Empty; $hash["DataCenter"] = [String]::Empty; $hash["Sku"] = [String]::Empty; $hash["Type"] = [String]::Empty; $hash["Version"] = [String]::Empty; $hash["BaseLanguage"] = [String]::Empty; $hash["State"] = [String]::Empty; $hash["CreationTemplates"] = @(); $hash["ConnectionString"] = [String]::Empty; $hash["ParentConnection"] = $null; $object = New-Object PsObject -Property $hash; $object; } end { $StopWatch.Stop(); Trace-XrmFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function New-XrmInstance -Alias *; |