@@ -189,6 +189,33 @@ func parseAzureAppInsightsMetadata(config *scalersconfig.ScalerConfig, logger lo
189
189
return & meta , nil
190
190
}
191
191
192
+ // parseAzurePodIdentityParams gets the activeDirectory clientID and password
193
+ func parseAzurePodIdentityParams (config * scalersconfig.ScalerConfig ) (clientID string , clientPassword string , err error ) {
194
+ switch config .PodIdentity .Provider {
195
+ case "" , kedav1alpha1 .PodIdentityProviderNone :
196
+ clientID , err = getParameterFromConfig (config , "activeDirectoryClientId" , true )
197
+ if err != nil || clientID == "" {
198
+ return "" , "" , fmt .Errorf ("no activeDirectoryClientId given" )
199
+ }
200
+
201
+ if config .AuthParams ["activeDirectoryClientPassword" ] != "" {
202
+ clientPassword = config .AuthParams ["activeDirectoryClientPassword" ]
203
+ } else if config .TriggerMetadata ["activeDirectoryClientPasswordFromEnv" ] != "" {
204
+ clientPassword = config .ResolvedEnv [config .TriggerMetadata ["activeDirectoryClientPasswordFromEnv" ]]
205
+ }
206
+
207
+ if len (clientPassword ) == 0 {
208
+ return "" , "" , fmt .Errorf ("no activeDirectoryClientPassword given" )
209
+ }
210
+ case kedav1alpha1 .PodIdentityProviderAzureWorkload :
211
+ // no params required to be parsed
212
+ default :
213
+ return "" , "" , fmt .Errorf ("azure Monitor doesn't support pod identity %s" , config .PodIdentity .Provider )
214
+ }
215
+
216
+ return clientID , clientPassword , nil
217
+ }
218
+
192
219
func (s * azureAppInsightsScaler ) Close (context.Context ) error {
193
220
return nil
194
221
}
0 commit comments