Functions/Administration/Backup-CdsInstance.ps1
<#
.SYNOPSIS Backup instance #> function Backup-CdsInstance { [CmdletBinding()] param ( [Parameter(Mandatory, ValueFromPipeline)] [String] $InstanceDomainName, [Parameter(Mandatory=$true)] [String] $BackupLabel, [Parameter(Mandatory=$false)] [String] $BackupDescription ) begin { $StopWatch = [System.Diagnostics.Stopwatch]::StartNew(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Start -Parameters ($MyInvocation.MyCommand.Parameters); Assert-CdsAdminConnected; } process { $instance = Get-CdsInstance -Name $InstanceDomainName; $backupRequest = [pscustomobject]@{ Label = $BackupLabel Notes = $BackupDescription } Backup-PowerAppEnvironment -EnvironmentName $instance.Id -BackupRequestDefinition $backupRequest; } end { $StopWatch.Stop(); Trace-CdsFunction -Name $MyInvocation.MyCommand.Name -Stage Stop -StopWatch $StopWatch; } } Export-ModuleMember -Function Backup-CdsInstance -Alias *; |