Functions/Get-DeployPropertiesJson.ps1
|
<#
.SYNOPSIS Gets deployment properties in JSON format. .DESCRIPTION The Get-DeployPropertiesJson function retrieves deployment properties and returns them in JSON format. This is useful for examining deployment configurations and settings in a readable format. .PARAMETER action Specifies the deployment action (e.g., Publish, Script, Report). .PARAMETER TargetServerName Specifies the target SQL Server name. .PARAMETER TargetDatabaseName Specifies the target database name. .PARAMETER TargetUser Optional. Specifies the username for authentication. .PARAMETER TargetPasswordSecure Optional. Specifies the secure password for authentication. .PARAMETER TargetIntegratedSecurity Optional. Specifies whether integrated security is enabled. .PARAMETER ServiceObjective Optional. Specifies the Azure SQL Database service objective. .PARAMETER PublishFile Optional. Specifies the path to the publish profile file. .PARAMETER Variables Optional. Specifies SQLCMD variables for the deployment. .PARAMETER TargetTimeout Specifies the target connection timeout. .PARAMETER dacpacfile Specifies the path to the DACPAC file. .PARAMETER SettingsToCheck Optional. Specifies specific settings to include in the properties. .OUTPUTS String Returns deployment properties in JSON format. .EXAMPLE Get-DeployPropertiesJson -action "Publish" -TargetServerName "localhost" -TargetDatabaseName "MyDB" -dacpacfile "MyApp.dacpac" -TargetTimeout 60 Gets deployment properties for publishing MyApp.dacpac to MyDB. .NOTES This function provides a JSON representation of deployment properties for easier inspection and debugging of deployment configurations. #> function Get-DeployPropertiesJson { [CmdletBinding()] [OutputType([String])] param ( [Parameter(Mandatory = $true, HelpMessage = "Deployment action")] [string]$action, [Parameter(HelpMessage = "Target SQL Server name")] [string]$TargetServerName, [Parameter(HelpMessage = "Target database name")] [string]$TargetDatabaseName, [Parameter(HelpMessage = "Username for authentication")] [string]$TargetUser, [Parameter(HelpMessage = "Secure password for authentication")] [securestring]$TargetPasswordSecure, [Parameter(HelpMessage = "Whether integrated security is enabled")] [string]$TargetIntegratedSecurity, [Parameter(HelpMessage = "Azure SQL Database service objective")] $ServiceObjective, [Parameter(HelpMessage = "Path to publish profile file")] [string]$PublishFile, [Parameter(HelpMessage = "SQLCMD variables")] $Variables, [Parameter(Mandatory = $true, HelpMessage = "Target connection timeout")] $TargetTimeout, [Parameter(Mandatory = $true, HelpMessage = "Path to DACPAC file")] [string]$dacpacfile, [Parameter(HelpMessage = "Specific settings to check")] $SettingsToCheck ) $properties = Get-DeployPropertiesHash -action $action ` -TargetServerName $TargetServerName ` -TargetDatabaseName $TargetDatabaseName ` -TargetUser $TargetUser ` -TargetPasswordSecure $TargetPasswordSecure ` -TargetIntegratedSecurity $TargetIntegratedSecurity ` -ServiceObjective $ServiceObjective ` -PublishFile $PublishFile ` -Variables $Variables ` -TargetTimeout $TargetTimeout ` -dacpacfile $dacpacfile ` -SettingsToCheck $SettingsToCheck return Get-SettingsAsJson -settings $properties } |