@@ -48,19 +48,29 @@ export class FunctionAppResolver implements AppResourceResolver {
48
48
}
49
49
50
50
async function getSites20231201 ( context : IActionContext , subContext : ISubscriptionContext ) : Promise < ( Site & { properties ?: { functionAppConfig : FunctionAppConfig } } ) [ ] > {
51
- const headers = createHttpHeaders ( {
52
- 'Content-Type' : 'application/json' ,
53
- } ) ;
51
+ try {
52
+ const headers = createHttpHeaders ( {
53
+ 'Content-Type' : 'application/json' ,
54
+ } ) ;
55
+
56
+ const armEndpoint = ensureEndingSlash ( subContext . environment . resourceManagerEndpointUrl ) ;
57
+
58
+ // we need the new api-version to get the functionAppConfig
59
+ const options : AzExtRequestPrepareOptions = {
60
+ url : `${ armEndpoint } subscriptions/${ subContext . subscriptionId } /providers/Microsoft.Web/sites?api-version=2023-12-01` ,
61
+ method : 'GET' ,
62
+ headers
63
+ } ;
54
64
55
- // we need the new api-version to get the functionAppConfig
56
- const options : AzExtRequestPrepareOptions = {
57
- url : `https://management.azure.com/subscriptions/${ subContext . subscriptionId } /providers/Microsoft.Web/sites?api-version=2023-12-01` ,
58
- method : 'GET' ,
59
- headers
60
- } ;
65
+ const client = await createGenericClient ( context , subContext ) ;
66
+ const result = await client . sendRequest ( createPipelineRequest ( options ) ) as AzExtPipelineResponse ;
61
67
62
- const client = await createGenericClient ( context , subContext ) ;
63
- const result = await client . sendRequest ( createPipelineRequest ( options ) ) as AzExtPipelineResponse ;
64
- return ( result . parsedBody as { value : unknown } ) . value as ( Site & { properties ?: { functionAppConfig : FunctionAppConfig } } ) [ ] ;
68
+ return ( result . parsedBody as { value : unknown } ) . value as ( Site & { properties ?: { functionAppConfig : FunctionAppConfig } } ) [ ] ?? [ ] ;
69
+ } catch ( _error ) {
70
+ return [ ] ;
71
+ }
65
72
}
66
73
74
+ function ensureEndingSlash ( url : string ) : string {
75
+ return url . endsWith ( '/' ) ? url : `${ url } /` ;
76
+ }
0 commit comments