@@ -5721,6 +5721,13 @@ def list_consumption_locations(cmd):
57215721 return [{'name' : x .name .lower ().replace (' ' , '' )} for x in regions ]
57225722
57235723
5724+ def get_subscription_locations (cli_ctx ):
5725+ from azure .cli .core .commands .client_factory import get_subscription_service_client
5726+ subscription_client , subscription_id = get_subscription_service_client (cli_ctx )
5727+ result = list (subscription_client .subscriptions .list_locations (subscription_id ))
5728+ return [item .name for item in result ]
5729+
5730+
57245731def list_flexconsumption_locations (cmd , zone_redundant = False ):
57255732 if zone_redundant :
57265733 return list_flexconsumption_zone_redundant_locations (cmd )
@@ -5729,8 +5736,10 @@ def list_flexconsumption_locations(cmd, zone_redundant=False):
57295736 sub_id = get_subscription_id (cmd .cli_ctx )
57305737 geo_regions_api = 'subscriptions/{}/providers/Microsoft.Web/geoRegions?sku=FlexConsumption&api-version=2023-01-01'
57315738 request_url = cmd .cli_ctx .cloud .endpoints .resource_manager + geo_regions_api .format (sub_id )
5732- regions = send_raw_request (cmd .cli_ctx , "GET" , request_url ).json ()['value' ]
5733- return [{'name' : x ['name' ].lower ().replace (' ' , '' )} for x in regions ]
5739+ flex_regions = send_raw_request (cmd .cli_ctx , "GET" , request_url ).json ()['value' ]
5740+ flex_regions_list = [{'name' : x ['name' ].lower ().replace (' ' , '' )} for x in flex_regions ]
5741+ sub_regions_list = get_subscription_locations (cmd .cli_ctx )
5742+ return [x for x in flex_regions_list if x ['name' ] in sub_regions_list ]
57345743
57355744
57365745def list_locations (cmd , sku , linux_workers_enabled = None , hyperv_workers_enabled = None ):
0 commit comments