📝

Azure Functionをローカルで開発するときにazuriteを使う

2021/03/18に公開

Azure Functionsをローカルで開発しているときはAzure Storage Emulator
がいる。テンプレートから普通にプロジェクトを作成すると、local.settings.jsonを見ると以下のようになっている。

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true", // <-- これ
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

これをAzuriteを利用するようにしたい。AzureWebJobStorageの値を次のように変えるだけ。

{
  "IsEncrypted": false,
  "Values": {
    // ↓ これ
    "AzureWebJobsStorage": "DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;QueueEndpoint=http://127.0.0.1:10001/devstoreaccount1;",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  }
}

接続文字列についてはここら辺で紹介されている。

Discussion