Skip to content

Commit 305c42c

Browse files
committed
Create consumption plan when creating the function app
1 parent 73addea commit 305c42c

20 files changed

+13581
-5247
lines changed

src/azure-cli/azure/cli/command_modules/appservice/custom.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4934,6 +4934,11 @@ def create_functionapp(cmd, resource_group_name, name, storage_account, plan=Non
49344934
functionapp_def.kind = 'functionapp'
49354935
# if os_type is None, the os type is windows
49364936
is_linux = bool(os_type and os_type.lower() == LINUX_OS_NAME)
4937+
plan_name = generatePlanName(resource_group_name)
4938+
poller = create_functionapp_app_service_plan(cmd, resource_group_name, plan_name, is_linux,
4939+
'Y1', location=consumption_plan_location)
4940+
plan_info = LongRunningOperation(cmd.cli_ctx)(poller)
4941+
functionapp_def.server_farm_id = plan_info.id
49374942

49384943
elif plan: # apps with SKU based plan
49394944
if is_valid_resource_id(plan):
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
interactions:
2+
- request:
3+
body: '{"location": "southcentralus", "sku": {"name": "Y1", "tier": "Dynamic"},
4+
"properties": {"perSiteScaling": false, "reserved": true, "isXenon": false,
5+
"zoneRedundant": false}}'
6+
headers:
7+
Accept:
8+
- application/json
9+
Accept-Encoding:
10+
- gzip, deflate
11+
CommandName:
12+
- functionapp plan create
13+
Connection:
14+
- keep-alive
15+
Content-Length:
16+
- '173'
17+
Content-Type:
18+
- application/json
19+
ParameterSetName:
20+
- -g -n --sku --is-linux --location
21+
User-Agent:
22+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)
23+
method: PUT
24+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003?api-version=2023-01-01
25+
response:
26+
body:
27+
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003","name":"functionappplan000003","type":"Microsoft.Web/serverfarms","kind":"functionapp","location":"southcentralus","properties":{"serverFarmId":85059,"name":"functionappplan000003","sku":{"name":"Y1","tier":"Dynamic","size":"Y1","family":"Y","capacity":0},"workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":0,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":0,"status":"Ready","webSpace":"clitest.rg000001-SouthCentralUSwebspace-Linux","subscription":"dbf67cc6-6c57-44b8-97fc-4356f0d555b3","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":0,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dynamic","siteMode":null,"geoRegion":"South
28+
Central US","perSiteScaling":false,"elasticScaleEnabled":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"functionapp","resourceGroup":"clitest.rg000001","reserved":true,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-sn1-147_85059","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null,"kubeEnvironmentProfile":null,"zoneRedundant":false,"migrateToVMSS":null,"vnetConnectionsUsed":null,"vnetConnectionsMax":null,"createdTime":"2025-01-03T22:23:48.88"},"sku":{"name":"Y1","tier":"Dynamic","size":"Y1","family":"Y","capacity":0}}'
29+
headers:
30+
cache-control:
31+
- no-cache
32+
content-length:
33+
- '1651'
34+
content-type:
35+
- application/json
36+
date:
37+
- Fri, 03 Jan 2025 22:23:49 GMT
38+
expires:
39+
- '-1'
40+
pragma:
41+
- no-cache
42+
strict-transport-security:
43+
- max-age=31536000; includeSubDomains
44+
x-aspnet-version:
45+
- 4.0.30319
46+
x-cache:
47+
- CONFIG_NOCACHE
48+
x-content-type-options:
49+
- nosniff
50+
x-ms-ratelimit-remaining-subscription-global-writes:
51+
- '11999'
52+
x-ms-ratelimit-remaining-subscription-writes:
53+
- '799'
54+
x-msedge-ref:
55+
- 'Ref A: 5AE61731DA75468DB58D9011649A6528 Ref B: CH1AA2020620053 Ref C: 2025-01-03T22:23:44Z'
56+
x-powered-by:
57+
- ASP.NET
58+
status:
59+
code: 200
60+
message: OK
61+
- request:
62+
body: null
63+
headers:
64+
Accept:
65+
- application/json
66+
Accept-Encoding:
67+
- gzip, deflate
68+
CommandName:
69+
- functionapp plan show
70+
Connection:
71+
- keep-alive
72+
ParameterSetName:
73+
- -g -n
74+
User-Agent:
75+
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)
76+
method: GET
77+
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003?api-version=2023-01-01
78+
response:
79+
body:
80+
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003","name":"functionappplan000003","type":"Microsoft.Web/serverfarms","kind":"functionapp","location":"South
81+
Central US","properties":{"serverFarmId":85059,"name":"functionappplan000003","workerSize":"Default","workerSizeId":0,"workerTierName":null,"numberOfWorkers":0,"currentWorkerSize":"Default","currentWorkerSizeId":0,"currentNumberOfWorkers":0,"status":"Ready","webSpace":"clitest.rg000001-SouthCentralUSwebspace-Linux","subscription":"dbf67cc6-6c57-44b8-97fc-4356f0d555b3","adminSiteName":null,"hostingEnvironment":null,"hostingEnvironmentProfile":null,"maximumNumberOfWorkers":0,"planName":"VirtualDedicatedPlan","adminRuntimeSiteName":null,"computeMode":"Dynamic","siteMode":null,"geoRegion":"South
82+
Central US","perSiteScaling":false,"elasticScaleEnabled":false,"maximumElasticWorkerCount":1,"numberOfSites":0,"hostingEnvironmentId":null,"isSpot":false,"spotExpirationTime":null,"freeOfferExpirationTime":null,"tags":null,"kind":"functionapp","resourceGroup":"clitest.rg000001","reserved":true,"isXenon":false,"hyperV":false,"mdmId":"waws-prod-sn1-147_85059","targetWorkerCount":0,"targetWorkerSizeId":0,"provisioningState":"Succeeded","webSiteId":null,"existingServerFarmIds":null,"kubeEnvironmentProfile":null,"zoneRedundant":false,"migrateToVMSS":null,"vnetConnectionsUsed":0,"vnetConnectionsMax":2,"createdTime":"2025-01-03T22:23:48.88"},"sku":{"name":"Y1","tier":"Dynamic","size":"Y1","family":"Y","capacity":0}}'
83+
headers:
84+
cache-control:
85+
- no-cache
86+
content-length:
87+
- '1572'
88+
content-type:
89+
- application/json
90+
date:
91+
- Fri, 03 Jan 2025 22:23:49 GMT
92+
expires:
93+
- '-1'
94+
pragma:
95+
- no-cache
96+
strict-transport-security:
97+
- max-age=31536000; includeSubDomains
98+
x-aspnet-version:
99+
- 4.0.30319
100+
x-cache:
101+
- CONFIG_NOCACHE
102+
x-content-type-options:
103+
- nosniff
104+
x-ms-ratelimit-remaining-subscription-global-reads:
105+
- '16499'
106+
x-msedge-ref:
107+
- 'Ref A: C159896C87584A2C968CCAA3207EFBB5 Ref B: CH1AA2020620033 Ref C: 2025-01-03T22:23:49Z'
108+
x-powered-by:
109+
- ASP.NET
110+
status:
111+
code: 200
112+
message: OK
113+
version: 1

0 commit comments

Comments
 (0)