0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Azure Functions でパブリックプレビューの Flex Consumption を Azure CLI で試してみた

Posted at

新しい Azure Functions ホスティングプランの Flex Consumption が発表されました。パブリックプレビューですが、既に Azure CLI でも使用できるようなので試してみました。

動作確認バージョン

bash
$ dotnet --version
8.0.100

$ func --version
4.0.5801

$ az version
{
  "azure-cli": "2.61.0",
  "azure-cli-core": "2.61.0",
  "azure-cli-telemetry": "1.1.0",
  "extensions": {}
}

検証用の Azure Functions Flex Consumption を作成

bash
prefix=mnrfna
region=eastus

az group create \
  --name ${prefix}-rg \
  --location $region

az storage account create \
  --name ${prefix}sa \
  --resource-group ${prefix}-rg \
  --sku Standard_LRS

az functionapp create \
  --name ${prefix} \
  --resource-group ${prefix}-rg \
  --flexconsumption-location $region \
  --instance-memory 2048 \
  --runtime dotnet-isolated \
  --storage-account ${prefix}sa \
  --disable-app-insights \
  --https-only \
  --assign-identity

Azure ポータルで Flex Consumption を確認

functions-flex-consumption-01.png

ローカルで検証用の Functions アプリを作成

bash
func init $prefix --worker-runtime dotnet-isolated --target-framework net8.0

cd $prefix

func new --name example --template HttpTrigger --authlevel anonymous

func start

検証用 Functions アプリをデプロイ

bash
func azure functionapp publish $prefix

Can't determine Project to build. Expected 1 .csproj or .fsproj but found 2 と表示されたので、ローカル環境をクリーンにしてからデプロイしなおしました。

bash
dotnet clean

func azure functionapp publish $prefix

動作確認

bash
$ curl https://$prefix.azurewebsites.net/api/example

Welcome to Azure Functions!

後片付け

bash
az group delete \
  --name ${prefix}-rg \
  --yes

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?