@@ -816,7 +816,8 @@ class FunctionAppFlexMigrationTest(LiveScenarioTest):
816816 def test_functionapp_flex_migration_list_candidates (self , resource_group , storage_account ):
817817 eligible_functionapp_name = self .create_random_name ('consumption-func' , 24 )
818818 noneligible_slots_functionapp_name = self .create_random_name ('noneligible-slots-func' , 40 )
819- noneligible_cert_functionapp_name = self .create_random_name ('noneligible-cert-func' , 40 )
819+ eligible_cert_functionapp_name = self .create_random_name ('eligible-cert-func' , 40 )
820+
820821 slot_name = self .create_random_name (prefix = 'slotname' , length = 24 )
821822
822823 self .cmd ('functionapp create -g {} -n {} -c {} -s {} --os-type linux --runtime python --runtime-version 3.11 --functions-version 4'
@@ -828,31 +829,35 @@ def test_functionapp_flex_migration_list_candidates(self, resource_group, storag
828829 self .cmd ('functionapp deployment slot create -g {} -n {} --slot {}' .format (resource_group , noneligible_slots_functionapp_name , slot_name ))
829830
830831 self .cmd ('functionapp create -g {} -n {} -c {} -s {} --os-type linux --runtime python --runtime-version 3.11 --functions-version 4'
831- .format (resource_group , noneligible_cert_functionapp_name , FLEX_ASP_LOCATION_FUNCTIONAPP , storage_account ))
832+ .format (resource_group , eligible_cert_functionapp_name , FLEX_ASP_LOCATION_FUNCTIONAPP , storage_account ))
832833
833- self .cmd ('functionapp config appsettings set -g {} -n {} --settings WEBSITE_LOAD_CERTIFICATES=*' .format (resource_group , noneligible_cert_functionapp_name ))
834+ self .cmd ('functionapp config appsettings set -g {} -n {} --settings WEBSITE_LOAD_CERTIFICATES=*' .format (resource_group , eligible_cert_functionapp_name ))
834835
835836 candidates = self .cmd ('functionapp flex-migration list' ).get_output_in_json ().get ('eligible_apps' , [])
836837
837838 candidate_names = [candidate .get ('name' ) for candidate in candidates if 'name' in candidate ]
838839
839840 self .assertTrue (eligible_functionapp_name in candidate_names )
840841 self .assertTrue (noneligible_slots_functionapp_name in candidate_names )
841- self .assertTrue (noneligible_cert_functionapp_name not in candidate_names )
842+ # Apps with WEBSITE_LOAD_CERTIFICATES are now eligible with a warning note
843+ self .assertTrue (eligible_cert_functionapp_name in candidate_names )
844+ cert_candidate = next ((c for c in candidates if c .get ('name' ) == eligible_cert_functionapp_name ), None )
845+ self .assertIsNotNone (cert_candidate )
846+ self .assertIn ('WEBSITE_LOAD_CERTIFICATES' , cert_candidate .get ('note' , '' ))
842847
843848
844849 @ResourceGroupPreparer (location = WINDOWS_ASP_LOCATION_FUNCTIONAPP )
845850 @StorageAccountPreparer ()
846851 def test_functionapp_flex_migration_private_cert_list_candidates (self , resource_group , storage_account ):
847- noneligible_privatekey_functionapp_name = self .create_random_name ('noneligible-privatekey -func' , 40 )
852+ eligible_ssl_functionapp_name = self .create_random_name ('eligible-ssl -func' , 40 )
848853 pfx_file = os .path .join (TEST_DIR , 'server.pfx' )
849854 cert_password = 'test'
850855 cert_thumbprint = '9E9735C45C792B03B3FFCCA614852B32EE71AD6B'
851856
852857 self .cmd ('functionapp create -g {} -n {} -c {} -s {} --os-type linux --runtime python --runtime-version 3.11 --functions-version 4'
853- .format (resource_group , noneligible_privatekey_functionapp_name , WINDOWS_ASP_LOCATION_FUNCTIONAPP , storage_account ))
858+ .format (resource_group , eligible_ssl_functionapp_name , WINDOWS_ASP_LOCATION_FUNCTIONAPP , storage_account ))
854859
855- self .cmd ('webapp config ssl upload -g {} -n {} --certificate-file "{}" --certificate-password {} --certificate-name {}' .format (resource_group , noneligible_privatekey_functionapp_name , pfx_file , cert_password , "test123" ), checks = [
860+ self .cmd ('webapp config ssl upload -g {} -n {} --certificate-file "{}" --certificate-password {} --certificate-name {}' .format (resource_group , eligible_ssl_functionapp_name , pfx_file , cert_password , "test123" ), checks = [
856861 JMESPathCheck ('thumbprint' , cert_thumbprint ),
857862 JMESPathCheck ('name' , 'test123' )
858863 ])
@@ -861,20 +866,24 @@ def test_functionapp_flex_migration_private_cert_list_candidates(self, resource_
861866
862867 candidate_names = [candidate .get ('name' ) for candidate in candidates if 'name' in candidate ]
863868
864- self .assertTrue (noneligible_privatekey_functionapp_name in candidate_names )
869+ self .assertTrue (eligible_ssl_functionapp_name in candidate_names )
865870
866- self .cmd ('webapp config ssl bind -g {} -n {} --certificate-thumbprint {} --ssl-type {}' .format (resource_group , noneligible_privatekey_functionapp_name , cert_thumbprint , 'SNI' ), checks = [
871+ self .cmd ('webapp config ssl bind -g {} -n {} --certificate-thumbprint {} --ssl-type {}' .format (resource_group , eligible_ssl_functionapp_name , cert_thumbprint , 'SNI' ), checks = [
867872 JMESPathCheck ("hostNameSslStates|[?name=='{}.azurewebsites.net']|[0].sslState" .format (
868- noneligible_privatekey_functionapp_name ), 'SniEnabled' ),
873+ eligible_ssl_functionapp_name ), 'SniEnabled' ),
869874 JMESPathCheck ("hostNameSslStates|[?name=='{}.azurewebsites.net']|[0].thumbprint" .format (
870- noneligible_privatekey_functionapp_name ), cert_thumbprint )
875+ eligible_ssl_functionapp_name ), cert_thumbprint )
871876 ])
872877
873878 candidates = self .cmd ('functionapp flex-migration list' ).get_output_in_json ().get ('eligible_apps' , [])
874879
875880 candidate_names = [candidate .get ('name' ) for candidate in candidates if 'name' in candidate ]
876881
877- self .assertTrue (noneligible_privatekey_functionapp_name not in candidate_names )
882+ # Apps with SSL bindings are now eligible with a warning note
883+ self .assertTrue (eligible_ssl_functionapp_name in candidate_names )
884+ ssl_candidate = next ((c for c in candidates if c .get ('name' ) == eligible_ssl_functionapp_name ), None )
885+ self .assertIsNotNone (ssl_candidate )
886+ self .assertIn ('TSL/SSL certificates' , ssl_candidate .get ('note' , '' ))
878887
879888
880889 @ResourceGroupPreparer (location = FLEX_ASP_LOCATION_FUNCTIONAPP )
0 commit comments