Skip to content

Commit

Permalink
Create consumption plan when creating the function app
Browse files Browse the repository at this point in the history
  • Loading branch information
kamperiadis committed Jan 14, 2025
1 parent 5169006 commit f93258b
Show file tree
Hide file tree
Showing 20 changed files with 13,581 additions and 5,247 deletions.
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/appservice/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -4934,6 +4934,11 @@ def create_functionapp(cmd, resource_group_name, name, storage_account, plan=Non
functionapp_def.kind = 'functionapp'
# if os_type is None, the os type is windows
is_linux = bool(os_type and os_type.lower() == LINUX_OS_NAME)
plan_name = generatePlanName(resource_group_name)
poller = create_functionapp_app_service_plan(cmd, resource_group_name, plan_name, is_linux,
'Y1', location=consumption_plan_location)
plan_info = LongRunningOperation(cmd.cli_ctx)(poller)
functionapp_def.server_farm_id = plan_info.id

elif plan: # apps with SKU based plan
if is_valid_resource_id(plan):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
interactions:
- request:
body: '{"location": "southcentralus", "sku": {"name": "Y1", "tier": "Dynamic"},
"properties": {"perSiteScaling": false, "reserved": true, "isXenon": false,
"zoneRedundant": false}}'
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- functionapp plan create
Connection:
- keep-alive
Content-Length:
- '173'
Content-Type:
- application/json
ParameterSetName:
- -g -n --sku --is-linux --location
User-Agent:
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003?api-version=2023-01-01
response:
body:
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
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}}'
headers:
cache-control:
- no-cache
content-length:
- '1651'
content-type:
- application/json
date:
- Fri, 03 Jan 2025 22:23:49 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
x-aspnet-version:
- 4.0.30319
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-global-writes:
- '11999'
x-ms-ratelimit-remaining-subscription-writes:
- '799'
x-msedge-ref:
- 'Ref A: 5AE61731DA75468DB58D9011649A6528 Ref B: CH1AA2020620053 Ref C: 2025-01-03T22:23:44Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- application/json
Accept-Encoding:
- gzip, deflate
CommandName:
- functionapp plan show
Connection:
- keep-alive
ParameterSetName:
- -g -n
User-Agent:
- AZURECLI/2.67.0 azsdk-python-core/1.31.0 Python/3.11.9 (Windows-10-10.0.26100-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.Web/serverfarms/functionappplan000003?api-version=2023-01-01
response:
body:
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
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
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}}'
headers:
cache-control:
- no-cache
content-length:
- '1572'
content-type:
- application/json
date:
- Fri, 03 Jan 2025 22:23:49 GMT
expires:
- '-1'
pragma:
- no-cache
strict-transport-security:
- max-age=31536000; includeSubDomains
x-aspnet-version:
- 4.0.30319
x-cache:
- CONFIG_NOCACHE
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-global-reads:
- '16499'
x-msedge-ref:
- 'Ref A: C159896C87584A2C968CCAA3207EFBB5 Ref B: CH1AA2020620033 Ref C: 2025-01-03T22:23:49Z'
x-powered-by:
- ASP.NET
status:
code: 200
message: OK
version: 1
Loading

0 comments on commit f93258b

Please sign in to comment.