@@ -5709,6 +5709,13 @@ def list_consumption_locations(cmd):
57095709 return [{'name' : x .name .lower ().replace (' ' , '' )} for x in regions ]
57105710
57115711
5712+ def get_subscription_locations (cli_ctx ):
5713+ from azure .cli .core .commands .client_factory import get_subscription_service_client
5714+ subscription_client , subscription_id = get_subscription_service_client (cli_ctx )
5715+ result = list (subscription_client .subscriptions .list_locations (subscription_id ))
5716+ return [item .name for item in result ]
5717+
5718+
57125719def list_flexconsumption_locations (cmd , zone_redundant = False ):
57135720 if zone_redundant :
57145721 return list_flexconsumption_zone_redundant_locations (cmd )
@@ -5717,8 +5724,10 @@ def list_flexconsumption_locations(cmd, zone_redundant=False):
57175724 sub_id = get_subscription_id (cmd .cli_ctx )
57185725 geo_regions_api = 'subscriptions/{}/providers/Microsoft.Web/geoRegions?sku=FlexConsumption&api-version=2023-01-01'
57195726 request_url = cmd .cli_ctx .cloud .endpoints .resource_manager + geo_regions_api .format (sub_id )
5720- regions = send_raw_request (cmd .cli_ctx , "GET" , request_url ).json ()['value' ]
5721- return [{'name' : x ['name' ].lower ().replace (' ' , '' )} for x in regions ]
5727+ flex_regions = send_raw_request (cmd .cli_ctx , "GET" , request_url ).json ()['value' ]
5728+ flex_regions_list = [{'name' : x ['name' ].lower ().replace (' ' , '' )} for x in flex_regions ]
5729+ sub_regions_list = get_subscription_locations (cmd .cli_ctx )
5730+ return [x for x in flex_regions_list if x ['name' ] in sub_regions_list ]
57225731
57235732
57245733def list_locations (cmd , sku , linux_workers_enabled = None , hyperv_workers_enabled = None ):
0 commit comments