@@ -90,7 +90,8 @@ public IDnsProvider GetProvider(Type pluginType, string id)
9090
9191 // TODO : move this out, shared config should be injected
9292 var config = SharedUtils . ServiceConfigManager . GetAppServiceConfig ( ) ;
93- return new DnsProviderPoshACME ( scriptPath , config . PowershellExecutionPolicy ) { DelegateProviderDefinition = provider } ;
93+ var enableDebug = config . LogLevel ? . ToLower ( ) == "debug" ;
94+ return new DnsProviderPoshACME ( scriptPath , config . PowershellExecutionPolicy , enableDebug ) { DelegateProviderDefinition = provider } ;
9495 }
9596 }
9697
@@ -122,7 +123,7 @@ public List<ChallengeProviderDefinition> GetProviders(Type pluginType)
122123 List < ProviderParameter > IDnsProvider . ProviderParameters => Definition . ProviderParameters ;
123124
124125 private int ? _customPropagationDelay = null ;
125-
126+ private bool _enableDebug = false ;
126127 private Dictionary < string , string > _parameters ;
127128 private Dictionary < string , string > _credentials ;
128129
@@ -1209,14 +1210,16 @@ public List<ChallengeProviderDefinition> GetProviders(Type pluginType)
12091210 } ,
12101211 } ;
12111212
1212- public DnsProviderPoshACME ( string scriptPath , string scriptExecutionPolicy )
1213+ public DnsProviderPoshACME ( string scriptPath , string scriptExecutionPolicy , bool enableDebug )
12131214 {
12141215 _scriptExecutionPolicy = scriptExecutionPolicy ;
12151216
12161217 if ( scriptPath != null )
12171218 {
12181219 _poshAcmeScriptPath = scriptPath ;
12191220 }
1221+
1222+ this . _enableDebug = enableDebug ;
12201223 }
12211224
12221225 private string FormatParamKeyValue ( ProviderParameter parameterDefinition , KeyValuePair < string , string > paramKeyValue )
@@ -1391,6 +1394,12 @@ KeyValuePair<string, string> GetMostSpecificParameterValue(ProviderParameter s)
13911394 var args = string . Join ( "; " , formattedArgumentValues . ToArray ( ) ) ;
13921395
13931396 scriptContent += " $PluginArgs= @{" + args + "} \r \n " ;
1397+
1398+ if ( _enableDebug )
1399+ {
1400+ scriptContent += " $DebugPreference = \" Continue\" \r \n " ;
1401+ }
1402+
13941403 scriptContent += $ "{ action } -RecordName '{ recordName } ' -TxtValue '{ recordValue } ' @PluginArgs \r \n ";
13951404
13961405 return scriptContent ;
0 commit comments