LoginSignup
0
0

AzureストレージアカウントでWebコンテンツを公開する

Posted at

AzureストレージアカウントでWebコンテンツを公開する手順を解説します。

ストレージアカウントの作成

👇サブスクリプションの設定

az account set --subscription "***-***-***-***"

👇ストレージアカウントの作成

az storage account create^
 --name webstorageaccount11^
 --location japaneast^
 --resource-group sample_resource_group^
 --sku Standard_LRS

ストレージアカウントへの権限付与

az role assignment create^
 --role "Storage Blob Data Contributor"^
 --assignee "0000-0000-0000-0000-0000"^
 --scope "/subscriptions/***-***-***-***/resourceGroups/sample_resource_group/providers/Microsoft.Storage/storageAccounts/webstorageaccount11"

Web サイトのホスティングを有効にする

az storage blob service-properties update^
 --account-name webstorageaccount11^
 --static-website

サンプルHTMLの登録

👇サンプルHTML(test.html)を準備します。

<html>
  <h1>
    サンプルページ
  </h1>
</html>

👇ファイルアップロード

az storage blob upload^
 --account-name webstorageaccount11^
 --container-name $web^
 --name test.html^
 --file test.html^
 --auth-mode login

アクセスURLの取得

az storage account show^
 --name webstorageaccount11^
 --resource-group sample_resource_group^
 --query "primaryEndpoints.web"^
 --output tsv

👇以下のような出力が得られます。

https://webstorageaccount11.zxx.web.core.windows.net/

👇以下のURLで先ほどアップロードしたtest.htmlへアクセスします。

https://webstorageaccount11.zxx.web.core.windows.net/test.html

👇関連記事

👇参考URL

[keywords]
Azure CLI ストレージアカウント Web

AzureストレージアカウントでWebコンテンツを公開する

更新日:2024年02月13日

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