@@ -956,6 +956,173 @@ Task -Name "Set-Arm.Connections.ManagedApis.Eventhub.ManagedIdentity.AsArmObject
956956 Out-TaskFileArm - InputObject $armObj
957957}
958958
959+ # Original file: Set-Arm.Connections.ManagedApis.FtpWithSsl.Username.Advanced.AsArmObject.task.ps1
960+ $parm = @ {
961+ Description = @"
962+ Loops all `$ connections children
963+ -Validates that is of the type ftp
964+ --Creates a new resource in the ARM template, for the ApiConnection object
965+ --With matching ARM Parameters, for the Hostname, Username, Password
966+ --Makes sure the ARM Parameters logicAppLocation exists
967+ --Name & Displayname is extracted from the Api Connection Object
968+ Requires an authenticated session, either Az.Accounts or az cli
969+ "@
970+ Alias = " Arm.Set-Arm.Connections.ManagedApis.FtpWithSsl.Username.Advanced.AsArmObject"
971+ }
972+
973+ Task - Name " Set-Arm.Connections.ManagedApis.FtpWithSsl.Username.Advanced.AsArmObject" @parm - Action {
974+ Set-TaskWorkDirectory
975+
976+ # We can either use the az cli or the Az modules
977+ $tools = Get-PSFConfigValue - FullName PsLogicAppExtractor.Execution.Tools
978+
979+ $found = $false
980+
981+ $armObj = Get-TaskWorkObject
982+
983+ $armObj.resources [0 ].properties.parameters.' $connections' .value.PsObject.Properties | ForEach-Object {
984+
985+ if ($_.Value.id -like " *managedApis/ftp*" ) {
986+ $found = $true
987+
988+ # Fetch the details from the connection object
989+ $uri = " {0}?api-version=2018-07-01-preview" -f $ ($_.Value.connectionId )
990+
991+ if ($tools -eq " AzCli" ) {
992+ $resObj = az rest -- url $uri | ConvertFrom-Json
993+ }
994+ else {
995+ $resObj = Invoke-AzRestMethod - Path $uri - Method Get | Select-Object - ExpandProperty content | ConvertFrom-Json
996+ }
997+
998+ # Use the display name as the name of the resource
999+ $conName = $resObj.Name
1000+ $displayName = $resObj.Properties.DisplayName
1001+ $hostName = $resObj.Properties.ParameterValues.serverAddress
1002+ $userName = $resObj.Properties.ParameterValues.userName
1003+ $portNumber = $resObj.Properties.ParameterValues.serverPort
1004+ $sslEnabled = $resObj.Properties.ParameterValues.isSSL
1005+ $disableCertVali = $resObj.Properties.ParameterValues.disableCertificateValidation
1006+ $binary = $resObj.Properties.ParameterValues.isBinaryTransport
1007+ $closeCon = $resObj.Properties.ParameterValues.closeConnectionAfterRequestCompletion
1008+
1009+
1010+ # Fetch base template
1011+ $pathArms = " $ ( Get-PSFConfigValue - FullName PsLogicAppExtractor.ModulePath.Base) \internal\arms"
1012+ $apiObj = Get-Content - Path " $pathArms \API.FtpWithSsl.Username.json" - Raw | ConvertFrom-Json
1013+
1014+ # Set the names of the parameters
1015+ $Prefix = Get-PSFConfigValue - FullName PsLogicAppExtractor.prefixsuffix.connection.prefix
1016+ $hostPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _Hostname" - Value " $ ( $_.Name ) "
1017+ $userPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _Username" - Value " $ ( $_.Name ) "
1018+ $passPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _Password" - Value " $ ( $_.Name ) "
1019+ $portPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _Portnumber" - Value " $ ( $_.Name ) "
1020+ $sslPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _SslEnabled" - Value " $ ( $_.Name ) "
1021+ $disableCertValiPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _DisableCertificateValidation" - Value " $ ( $_.Name ) "
1022+ $binaryPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _BinaryTransport" - Value " $ ( $_.Name ) "
1023+ $closePreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _CloseConnectionAfterRequest" - Value " $ ( $_.Name ) "
1024+
1025+ $idPreSuf = Format-Name - Type " Connection" - Value " $ ( $_.Name ) "
1026+ $displayPreSuf = Format-Name - Type " Connection" - Prefix $Prefix - Suffix " _DisplayName" - Value " $ ( $_.Name ) "
1027+
1028+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $hostPreSuf " `
1029+ - Type " string" `
1030+ - Value " $hostName " `
1031+ - Description " The host / server address for the ftp server. ($ ( $_.Name ) )"
1032+
1033+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $userPreSuf " `
1034+ - Type " string" `
1035+ - Value " $userName " `
1036+ - Description " The username used to authenticate against the ftp server. ($ ( $_.Name ) )"
1037+
1038+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $passPreSuf " `
1039+ - Type " SecureString" `
1040+ - Value " " `
1041+ - Description " The password used to authenticate against the ftp server. ($ ( $_.Name ) )"
1042+
1043+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $portPreSuf " `
1044+ - Type " string" `
1045+ - Value " $portNumber " `
1046+ - Description " The port used to communicate with the ftp server. ($ ( $_.Name ) )"
1047+
1048+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $sslPreSuf " `
1049+ - Type " bool" `
1050+ - Value $sslEnabled `
1051+ - Description " True will make sure to use SSL connection against ftp server. ($ ( $_.Name ) )"
1052+
1053+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $disableCertValiPreSuf " `
1054+ - Type " bool" `
1055+ - Value $disableCertVali `
1056+ - Description " True will accept any certificate presented from the ftp server. ($ ( $_.Name ) )"
1057+
1058+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $binaryPreSuf " `
1059+ - Type " bool" `
1060+ - Value $binary `
1061+ - Description " True will force communication with the ftp server to be binary based. ($ ( $_.Name ) )"
1062+
1063+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $closePreSuf " `
1064+ - Type " bool" `
1065+ - Value $closeCon `
1066+ - Description " True will close/terminate the connection with the ftp server when a command is completed. ($ ( $_.Name ) )"
1067+
1068+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $displayPreSuf " `
1069+ - Type " string" `
1070+ - Value $displayName `
1071+ - Description " The display name of the ManagedApi connection object that is being utilized by the Logic App."
1072+
1073+ $armObj = Add-ArmParameter - InputObject $armObj - Name " $idPreSuf " `
1074+ - Type " string" `
1075+ - Value $conName `
1076+ - Description " The name / id of the ManagedApi connection object that is being utilized by the Logic App. Will be for the trigger and other actions that depend on connections."
1077+
1078+ # Update the api object properties
1079+ $apiObj.Name = " [parameters('$idPreSuf ')]"
1080+ $apiObj.properties.displayName = " [parameters('$displayPreSuf ')]"
1081+ $apiObj.Properties.ParameterValues.serverAddress = " [parameters('$hostPreSuf ')]"
1082+ $apiObj.Properties.ParameterValues.userName = " [parameters('$userPreSuf ')]"
1083+ $apiObj.Properties.ParameterValues.password = " [parameters('$passPreSuf ')]"
1084+ $apiObj.Properties.ParameterValues.serverPort = " [parameters('$portPreSuf ')]"
1085+ $apiObj.Properties.ParameterValues.isSSL = " [parameters('$sslPreSuf ')]"
1086+ $apiObj.Properties.ParameterValues.disableCertificateValidation = " [parameters('$disableCertValiPreSuf ')]"
1087+ $apiObj.Properties.ParameterValues.isBinaryTransport = " [parameters('$binaryPreSuf ')]"
1088+ $apiObj.Properties.ParameterValues.closeConnectionAfterRequestCompletion = " [parameters('$closePreSuf ')]"
1089+
1090+ # Update the api connection object type
1091+ $_.Value.id -match " /managedApis/(.*)"
1092+ $conType = $Matches [1 ]
1093+ $apiObj.properties.api.id = $apiObj.properties.api.id.Replace (" ##TYPE##" , $conType )
1094+
1095+ # Append the new resource to the ARM template
1096+ $armObj.resources += $apiObj
1097+
1098+ if ($null -eq $armObj.resources [0 ].dependsOn) {
1099+ # Create the dependsOn array if it does not exist
1100+ $armObj.resources [0 ] | Add-Member - MemberType NoteProperty - Name " dependsOn" - Value @ ()
1101+ }
1102+
1103+ # Add the new resource to the dependsOn array, so that the deployment will work
1104+ $armObj.resources [0 ].dependsOn += " [resourceId('Microsoft.Web/connections', parameters('$idPreSuf '))]"
1105+
1106+ # Adjust the connection object to depend on the same name
1107+ $_.Value.connectionId = " [resourceId('Microsoft.Web/connections', parameters('$idPreSuf '))]"
1108+ $_.Value.connectionName = " [parameters('$idPreSuf ')]"
1109+ $_.Value.id = " [format('/subscriptions/{0}/providers/Microsoft.Web/locations/{1}/managedApis/$conType ', subscription().subscriptionId, parameters('logicAppLocation'))]"
1110+ }
1111+ }
1112+
1113+ if ($found ) {
1114+ # We need the location parameter
1115+ if ($null -eq $armObj.parameters.logicAppLocation ) {
1116+ $armObj = Add-ArmParameter - InputObject $armObj - Name " logicAppLocation" `
1117+ - Type " string" `
1118+ - Value " [resourceGroup().location]" `
1119+ - Description " Location of the Logic App. Best practice recommendation is to make this depending on the Resource Group and its location."
1120+ }
1121+ }
1122+
1123+ Out-TaskFileArm - InputObject $armObj
1124+ }
1125+
9591126# Original file: Set-Arm.Connections.ManagedApis.Generic.Advanced.AsArmObject.task.ps1
9601127$parm = @ {
9611128 Description = @"
@@ -2162,11 +2329,10 @@ Task -Name "Set-Arm.Connections.ManagedApis.Servicebus.ManagedIdentity.AsArmObje
21622329$parm = @ {
21632330 Description = @"
21642331Loops all `$ connections children
2165- -Validates that is of the type azuretable
2332+ -Validates that is of the type sftp
21662333--Creates a new resource in the ARM template, for the ApiConnection object
2167- --With matching ARM Parameters, for the SubscriptionId, ResourceGroup, Namespace, Key
2334+ --With matching ARM Parameters, for the Hostname, Username, Password
21682335--Makes sure the ARM Parameters logicAppLocation exists
2169- --The type is based on ListKey / ConnectionString approach
21702336--Name & Displayname is extracted from the Api Connection Object
21712337Requires an authenticated session, either Az.Accounts or az cli
21722338"@
@@ -3402,7 +3568,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.EvaluatedRecurrence.AsParameter" @parm
34023568 $armObj = Add-ArmParameter - InputObject $armObj - Name " $frequencyPreSuf " `
34033569 - Type " string" `
34043570 - Value $orgFrequency `
3405- - Description " The frequency used for the trigger to evalutate ."
3571+ - Description " The frequency used for the trigger to evaluate ."
34063572
34073573 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.evaluatedRecurrence.frequency = " [parameters('$frequencyPreSuf ')]"
34083574
@@ -3411,7 +3577,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.EvaluatedRecurrence.AsParameter" @parm
34113577 $armObj = Add-ArmParameter - InputObject $armObj - Name " $intervalPreSuf " `
34123578 - Type " int" `
34133579 - Value $orgInterval `
3414- - Description " The interval used for the trigger to evalutate ."
3580+ - Description " The interval used for the trigger to evaluate ."
34153581
34163582 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.evaluatedRecurrence.interval = " [parameters('$intervalPreSuf ')]"
34173583
@@ -3421,7 +3587,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.EvaluatedRecurrence.AsParameter" @parm
34213587 $armObj = Add-ArmParameter - InputObject $armObj - Name " $startTimePreSuf " `
34223588 - Type " string" `
34233589 - Value $orgStartTime `
3424- - Description " The start time used for the trigger to evalutate ."
3590+ - Description " The start time used for the trigger to evaluate ."
34253591
34263592 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.evaluatedRecurrence.startTime = " [parameters('$startTimePreSuf ')]"
34273593 }
@@ -3432,7 +3598,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.EvaluatedRecurrence.AsParameter" @parm
34323598 $armObj = Add-ArmParameter - InputObject $armObj - Name " $timeZonePreSuf " `
34333599 - Type " string" `
34343600 - Value $orgTimeZone `
3435- - Description " The time zone used for the trigger to evalutate ."
3601+ - Description " The time zone used for the trigger to evaluate ."
34363602
34373603 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.evaluatedRecurrence.timeZone = " [parameters('$timeZonePreSuf ')]"
34383604 }
@@ -3491,7 +3657,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.Recurrence.AsParameter" @parm -Action
34913657 $armObj = Add-ArmParameter - InputObject $armObj - Name " $startTimePreSuf " `
34923658 - Type " string" `
34933659 - Value $orgStartTime `
3494- - Description " The start time used for the trigger to evalutate ."
3660+ - Description " The start time used for the trigger to evaluate ."
34953661
34963662 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.recurrence.startTime = " [parameters('$startTimePreSuf ')]"
34973663 }
@@ -3502,7 +3668,7 @@ Task -Name "Set-Arm.Trigger.ApiConnection.Recurrence.AsParameter" @parm -Action
35023668 $armObj = Add-ArmParameter - InputObject $armObj - Name " $timeZonePreSuf " `
35033669 - Type " string" `
35043670 - Value $orgTimeZone `
3505- - Description " The time zone used for the trigger to evalutate ."
3671+ - Description " The time zone used for the trigger to evaluate ."
35063672
35073673 $armObj.resources [0 ].properties.definition.triggers.PsObject.Properties.Value.recurrence.timeZone = " [parameters('$timeZonePreSuf ')]"
35083674 }
0 commit comments