Microsoft.Web 靜態網站

Bicep 資源定義

staticSites 資源類型可以使用目標作業來部署:

如需每個 API 版本中已變更屬性的清單,請參閱 變更記錄檔。

使用範例

Bicep 範例

部署靜態 Web 應用程式的基本範例。

param resourceName string = 'acctest0001'
param location string = 'westeurope'

resource staticSite 'Microsoft.Web/staticSites@2021-02-01' = {
  name: resourceName
  location: location
  sku: {
    name: 'Free'
    tier: 'Free'
  }
  properties: {}
}

Azure 已驗證的模組

下列 Azure 驗證模組 可用來部署此資源類型。

模組 描述
靜態 Web 應用程式 靜態 Web 應用程式的 AVM 資源模組

資源格式

若要建立 Microsoft.Web/staticSites 資源,請將下列 Bicep 新增至範本。

resource symbolicname 'Microsoft.Web/staticSites@2025-03-01' = {
  identity: {
    type: 'string'
    userAssignedIdentities: {
      {customized property}: {}
    }
  }
  kind: 'string'
  location: 'string'
  name: 'string'
  properties: {
    allowConfigFileUpdates: bool
    branch: 'string'
    buildProperties: {
      apiBuildCommand: 'string'
      apiLocation: 'string'
      appArtifactLocation: 'string'
      appBuildCommand: 'string'
      appLocation: 'string'
      githubActionSecretNameOverride: 'string'
      outputLocation: 'string'
      skipGithubActionWorkflowGeneration: bool
    }
    enterpriseGradeCdnStatus: 'string'
    provider: 'string'
    publicNetworkAccess: 'string'
    repositoryToken: 'string'
    repositoryUrl: 'string'
    stagingEnvironmentPolicy: 'string'
    templateProperties: {
      description: 'string'
      isPrivate: bool
      owner: 'string'
      repositoryName: 'string'
      templateRepositoryUrl: 'string'
    }
  }
  sku: {
    capabilities: [
      {
        name: 'string'
        reason: 'string'
        value: 'string'
      }
    ]
    capacity: int
    family: 'string'
    locations: [
      'string'
    ]
    name: 'string'
    size: 'string'
    skuCapacity: {
      default: int
      elasticMaximum: int
      maximum: int
      minimum: int
      scaleType: 'string'
    }
    tier: 'string'
  }
  tags: {
    {customized property}: 'string'
  }
}

屬性值

Microsoft.Web/靜態網站

名字 描述 價值
身分識別 受控服務識別。 ManagedServiceIdentity
類 資源種類。 如果資源是應用程式,您可以參考 https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference 以取得種類支援的詳細值。 字串
位置 資源位置。 字串 (必要)
名字 資源名稱 字串 (必要)
性能 核心資源屬性 靜態網站
SKU 可調整資源的 SKU 描述。 Sku描述
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤

能力

名字 描述 價值
名字 SKU 功能的名稱。 字串
原因 SKU 功能的原因。 字串
價值 SKU 功能的值。 字串

ManagedServiceIdentity

名字 描述 價值
型別 受控服務識別的類型。 “無”
“系統分配”
'SystemAssigned, UserAssigned'
'UserAssigned'
使用者指派的身份 與資源相關聯的使用者指派身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

SkuCapacity

名字 描述 價值
預設 此 App Service 方案 SKU 的預設背景工作角色數目。 整數 (int)
彈性最大值 此 App Service 方案 SKU 的彈性背景工作角色數目上限。 整數 (int)
最大 此 App Service 方案 SKU 的工作者數目上限。 整數 (int)
最低 此 App Service 方案 SKU 的最小背景工作角色數目。 整數 (int)
scaleType App Service 方案的可用調整組態。 字串

Sku描述

名字 描述 價值
能力 SKU 的功能,例如流量管理員是否已啟用? 功能[]
容量 目前指派給資源的實例數目。 整數 (int)
家庭 資源 SKU 的系列程式代碼。 字串
地點 SKU 的位置。 字串[]
名字 資源 SKU 的名稱。 字串
大小 資源 SKU 的大小規範。 字串
skuCapacity SKU 的最小、最大值和預設小數字數值。 SkuCapacity
分層 資源 SKU 的服務層級。 字串

靜態網站

名字 描述 價值
allowConfigFileUpdates 如果已鎖定此靜態 Web 應用程式的組態檔,<程式代碼>false</code>;否則,<程式代碼>true</code>。 布爾 (bool)
branch 存放庫中的目標分支。 字串
buildProperties 建置屬性以在存放庫上設定。 StaticSiteBuildProperties
enterpriseGradeCdnStatus 狀態,指出提供靜態 Web 應用程式流量的企業級 CDN 狀態。 “已禁用”
'停用'
“已啟用”
'啟用'
提供者 提交最後一個部署至靜態月臺主要環境的提供者。 字串
公共網路存取 指出靜態 Web 應用程式是否允許公用流量的狀態。 允許的值:『Enabled』、『Disabled』 或空字串。 字串
repositoryToken 使用者的 github 存放庫令牌。 這可用來設定 Github Actions 工作流程檔案和 API 秘密。 字串
repositoryUrl 的 靜態網站存放庫的URL。 字串
stagingEnvironmentPolicy 指出靜態 Web 應用程式是否允許或不允許預備環境的狀態。 “已禁用”
“已啟用”
templateProperties 產生新存放庫的範本選項。 StaticSiteTemplateOptions

StaticSiteBuildProperties

名字 描述 價值
apiBuild命令 在 Azure Functions API 應用程式部署期間執行的自定義命令。 字串
apiLocation 存放庫內 API 程式代碼的路徑。 字串
appArtifactLocation 已淘汰:建置後的應用程式成品路徑(已取代為 OutputLocation) 字串
appBuildCommand 在部署靜態內容應用程式期間執行的自定義命令。 字串
appLocation 存放庫內應用程式程式代碼的路徑。 字串
githubActionSecretNameOverride Github Action 秘密名稱覆寫。 字串
outputLocation 建置後應用程式的輸出路徑。 字串
skipGithubActionWorkflowGeneration 略過 Github Action 工作流程產生。 布爾 (bool)

StaticSiteTemplateOptions

名字 描述 價值
描述 新產生的存放庫描述。 字串
isPrivate 新產生的存放庫是否為私人存放庫。 默認為 false (亦即 public)。 布爾 (bool)
擁有者 新產生的存放庫擁有者。 字串
repositoryName (儲存庫名稱) 新產生的存放庫名稱。 字串
templateRepositoryUrl 的 範本存放庫的 URL。 新產生的存放庫將會以此存放庫為基礎。 字串

UserAssignedIdentity

名字 描述 價值

ARM 樣本資源定義

staticSites 資源類型可以使用目標作業來部署:

使用範例

資源格式

若要建立 Microsoft.Web/staticSites 資源,請將下列 JSON 新增至範本。

{
  "type": "Microsoft.Web/staticSites",
  "apiVersion": "2025-03-01",
  "name": "string",
  "identity": {
    "type": "string",
    "userAssignedIdentities": {
      "{customized property}": {
      }
    }
  },
  "kind": "string",
  "location": "string",
  "properties": {
    "allowConfigFileUpdates": "bool",
    "branch": "string",
    "buildProperties": {
      "apiBuildCommand": "string",
      "apiLocation": "string",
      "appArtifactLocation": "string",
      "appBuildCommand": "string",
      "appLocation": "string",
      "githubActionSecretNameOverride": "string",
      "outputLocation": "string",
      "skipGithubActionWorkflowGeneration": "bool"
    },
    "enterpriseGradeCdnStatus": "string",
    "provider": "string",
    "publicNetworkAccess": "string",
    "repositoryToken": "string",
    "repositoryUrl": "string",
    "stagingEnvironmentPolicy": "string",
    "templateProperties": {
      "description": "string",
      "isPrivate": "bool",
      "owner": "string",
      "repositoryName": "string",
      "templateRepositoryUrl": "string"
    }
  },
  "sku": {
    "capabilities": [
      {
        "name": "string",
        "reason": "string",
        "value": "string"
      }
    ],
    "capacity": "int",
    "family": "string",
    "locations": [ "string" ],
    "name": "string",
    "size": "string",
    "skuCapacity": {
      "default": "int",
      "elasticMaximum": "int",
      "maximum": "int",
      "minimum": "int",
      "scaleType": "string"
    },
    "tier": "string"
  },
  "tags": {
    "{customized property}": "string"
  }
}

屬性值

Microsoft.Web/靜態網站

名字 描述 價值
apiVersion API 版本 '2025-03-01'
身分識別 受控服務識別。 ManagedServiceIdentity
類 資源種類。 如果資源是應用程式,您可以參考 https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference 以取得種類支援的詳細值。 字串
位置 資源位置。 字串 (必要)
名字 資源名稱 字串 (必要)
性能 核心資源屬性 靜態網站
SKU 可調整資源的 SKU 描述。 Sku描述
標籤 資源標籤 標記名稱和值的字典。 請參閱範本中的 標籤
型別 資源類型 “Microsoft.Web/staticSites”

能力

名字 描述 價值
名字 SKU 功能的名稱。 字串
原因 SKU 功能的原因。 字串
價值 SKU 功能的值。 字串

ManagedServiceIdentity

名字 描述 價值
型別 受控服務識別的類型。 “無”
“系統分配”
'SystemAssigned, UserAssigned'
'UserAssigned'
使用者指派的身份 與資源相關聯的使用者指派身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

SkuCapacity

名字 描述 價值
預設 此 App Service 方案 SKU 的預設背景工作角色數目。 整數 (int)
彈性最大值 此 App Service 方案 SKU 的彈性背景工作角色數目上限。 整數 (int)
最大 此 App Service 方案 SKU 的工作者數目上限。 整數 (int)
最低 此 App Service 方案 SKU 的最小背景工作角色數目。 整數 (int)
scaleType App Service 方案的可用調整組態。 字串

Sku描述

名字 描述 價值
能力 SKU 的功能,例如流量管理員是否已啟用? 功能[]
容量 目前指派給資源的實例數目。 整數 (int)
家庭 資源 SKU 的系列程式代碼。 字串
地點 SKU 的位置。 字串[]
名字 資源 SKU 的名稱。 字串
大小 資源 SKU 的大小規範。 字串
skuCapacity SKU 的最小、最大值和預設小數字數值。 SkuCapacity
分層 資源 SKU 的服務層級。 字串

靜態網站

名字 描述 價值
allowConfigFileUpdates 如果已鎖定此靜態 Web 應用程式的組態檔,<程式代碼>false</code>;否則,<程式代碼>true</code>。 布爾 (bool)
branch 存放庫中的目標分支。 字串
buildProperties 建置屬性以在存放庫上設定。 StaticSiteBuildProperties
enterpriseGradeCdnStatus 狀態,指出提供靜態 Web 應用程式流量的企業級 CDN 狀態。 “已禁用”
'停用'
“已啟用”
'啟用'
提供者 提交最後一個部署至靜態月臺主要環境的提供者。 字串
公共網路存取 指出靜態 Web 應用程式是否允許公用流量的狀態。 允許的值:『Enabled』、『Disabled』 或空字串。 字串
repositoryToken 使用者的 github 存放庫令牌。 這可用來設定 Github Actions 工作流程檔案和 API 秘密。 字串
repositoryUrl 的 靜態網站存放庫的URL。 字串
stagingEnvironmentPolicy 指出靜態 Web 應用程式是否允許或不允許預備環境的狀態。 “已禁用”
“已啟用”
templateProperties 產生新存放庫的範本選項。 StaticSiteTemplateOptions

StaticSiteBuildProperties

名字 描述 價值
apiBuild命令 在 Azure Functions API 應用程式部署期間執行的自定義命令。 字串
apiLocation 存放庫內 API 程式代碼的路徑。 字串
appArtifactLocation 已淘汰:建置後的應用程式成品路徑(已取代為 OutputLocation) 字串
appBuildCommand 在部署靜態內容應用程式期間執行的自定義命令。 字串
appLocation 存放庫內應用程式程式代碼的路徑。 字串
githubActionSecretNameOverride Github Action 秘密名稱覆寫。 字串
outputLocation 建置後應用程式的輸出路徑。 字串
skipGithubActionWorkflowGeneration 略過 Github Action 工作流程產生。 布爾 (bool)

StaticSiteTemplateOptions

名字 描述 價值
描述 新產生的存放庫描述。 字串
isPrivate 新產生的存放庫是否為私人存放庫。 默認為 false (亦即 public)。 布爾 (bool)
擁有者 新產生的存放庫擁有者。 字串
repositoryName (儲存庫名稱) 新產生的存放庫名稱。 字串
templateRepositoryUrl 的 範本存放庫的 URL。 新產生的存放庫將會以此存放庫為基礎。 字串

UserAssignedIdentity

名字 描述 價值

Terraform (AzAPI 提供者) 資源定義

staticSites 資源類型可以使用目標作業來部署:

  • 資源團體 關於每個 API 版本變更屬性的清單,請參見 變更日誌。

使用範例

Terraform 範例

部署靜態 Web 應用程式的基本範例。

terraform {
  required_providers {
    azapi = {
      source = "Azure/azapi"
    }
  }
}

provider "azapi" {
  skip_provider_registration = false
}

variable "resource_name" {
  type    = string
  default = "acctest0001"
}

variable "location" {
  type    = string
  default = "westeurope"
}

resource "azapi_resource" "resourceGroup" {
  type     = "Microsoft.Resources/resourceGroups@2020-06-01"
  name     = var.resource_name
  location = var.location
}

resource "azapi_resource" "staticSite" {
  type      = "Microsoft.Web/staticSites@2021-02-01"
  parent_id = azapi_resource.resourceGroup.id
  name      = var.resource_name
  location  = var.location
  body = {
    properties = {
    }
    sku = {
      name = "Free"
      tier = "Free"
    }
  }
  schema_validation_enabled = false
  response_export_values    = ["*"]
}

Azure 已驗證的模組

下列 Azure 驗證模組 可用來部署此資源類型。

模組 描述
靜態 Web 應用程式 靜態 Web 應用程式的 AVM 資源模組

資源格式

若要建立 Microsoft.Web/staticSites 資源,請將下列 Terraform 新增至範本。

resource "azapi_resource" "symbolicname" {
  type = "Microsoft.Web/staticSites@2025-03-01"
  name = "string"
  parent_id = "string"
  identity {
    type = "string"
    identity_ids = [
      "string"
    ]
  }
  location = "string"
  tags = {
    {customized property} = "string"
  }
  body = {
    kind = "string"
    properties = {
      allowConfigFileUpdates = bool
      branch = "string"
      buildProperties = {
        apiBuildCommand = "string"
        apiLocation = "string"
        appArtifactLocation = "string"
        appBuildCommand = "string"
        appLocation = "string"
        githubActionSecretNameOverride = "string"
        outputLocation = "string"
        skipGithubActionWorkflowGeneration = bool
      }
      enterpriseGradeCdnStatus = "string"
      provider = "string"
      publicNetworkAccess = "string"
      repositoryToken = "string"
      repositoryUrl = "string"
      stagingEnvironmentPolicy = "string"
      templateProperties = {
        description = "string"
        isPrivate = bool
        owner = "string"
        repositoryName = "string"
        templateRepositoryUrl = "string"
      }
    }
    sku = {
      capabilities = [
        {
          name = "string"
          reason = "string"
          value = "string"
        }
      ]
      capacity = int
      family = "string"
      locations = [
        "string"
      ]
      name = "string"
      size = "string"
      skuCapacity = {
        default = int
        elasticMaximum = int
        maximum = int
        minimum = int
        scaleType = "string"
      }
      tier = "string"
    }
  }
}

屬性值

Microsoft.Web/靜態網站

名字 描述 價值
身分識別 受控服務識別。 ManagedServiceIdentity
類 資源種類。 如果資源是應用程式,您可以參考 https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference 以取得種類支援的詳細值。 字串
位置 資源位置。 字串 (必要)
名字 資源名稱 字串 (必要)
性能 核心資源屬性 靜態網站
SKU 可調整資源的 SKU 描述。 Sku描述
標籤 資源標籤 標記名稱和值的字典。
型別 資源類型 “Microsoft.Web/staticSites@2025-03-01”

能力

名字 描述 價值
名字 SKU 功能的名稱。 字串
原因 SKU 功能的原因。 字串
價值 SKU 功能的值。 字串

ManagedServiceIdentity

名字 描述 價值
型別 受控服務識別的類型。 “無”
“系統分配”
'SystemAssigned, UserAssigned'
'UserAssigned'
使用者指派的身份 與資源相關聯的使用者指派身分識別清單。 使用者身分識別字典索引鍵參考的格式為 ARM 資源標識符:'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName} ManagedServiceIdentityUserAssignedIdentities

ManagedServiceIdentityUserAssignedIdentities

名字 描述 價值

資源標籤

名字 描述 價值

SkuCapacity

名字 描述 價值
預設 此 App Service 方案 SKU 的預設背景工作角色數目。 整數 (int)
彈性最大值 此 App Service 方案 SKU 的彈性背景工作角色數目上限。 整數 (int)
最大 此 App Service 方案 SKU 的工作者數目上限。 整數 (int)
最低 此 App Service 方案 SKU 的最小背景工作角色數目。 整數 (int)
scaleType App Service 方案的可用調整組態。 字串

Sku描述

名字 描述 價值
能力 SKU 的功能,例如流量管理員是否已啟用? 功能[]
容量 目前指派給資源的實例數目。 整數 (int)
家庭 資源 SKU 的系列程式代碼。 字串
地點 SKU 的位置。 字串[]
名字 資源 SKU 的名稱。 字串
大小 資源 SKU 的大小規範。 字串
skuCapacity SKU 的最小、最大值和預設小數字數值。 SkuCapacity
分層 資源 SKU 的服務層級。 字串

靜態網站

名字 描述 價值
allowConfigFileUpdates 如果已鎖定此靜態 Web 應用程式的組態檔,<程式代碼>false</code>;否則,<程式代碼>true</code>。 布爾 (bool)
branch 存放庫中的目標分支。 字串
buildProperties 建置屬性以在存放庫上設定。 StaticSiteBuildProperties
enterpriseGradeCdnStatus 狀態,指出提供靜態 Web 應用程式流量的企業級 CDN 狀態。 “已禁用”
'停用'
“已啟用”
'啟用'
提供者 提交最後一個部署至靜態月臺主要環境的提供者。 字串
公共網路存取 指出靜態 Web 應用程式是否允許公用流量的狀態。 允許的值:『Enabled』、『Disabled』 或空字串。 字串
repositoryToken 使用者的 github 存放庫令牌。 這可用來設定 Github Actions 工作流程檔案和 API 秘密。 字串
repositoryUrl 的 靜態網站存放庫的URL。 字串
stagingEnvironmentPolicy 指出靜態 Web 應用程式是否允許或不允許預備環境的狀態。 “已禁用”
“已啟用”
templateProperties 產生新存放庫的範本選項。 StaticSiteTemplateOptions

StaticSiteBuildProperties

名字 描述 價值
apiBuild命令 在 Azure Functions API 應用程式部署期間執行的自定義命令。 字串
apiLocation 存放庫內 API 程式代碼的路徑。 字串
appArtifactLocation 已淘汰:建置後的應用程式成品路徑(已取代為 OutputLocation) 字串
appBuildCommand 在部署靜態內容應用程式期間執行的自定義命令。 字串
appLocation 存放庫內應用程式程式代碼的路徑。 字串
githubActionSecretNameOverride Github Action 秘密名稱覆寫。 字串
outputLocation 建置後應用程式的輸出路徑。 字串
skipGithubActionWorkflowGeneration 略過 Github Action 工作流程產生。 布爾 (bool)

StaticSiteTemplateOptions

名字 描述 價值
描述 新產生的存放庫描述。 字串
isPrivate 新產生的存放庫是否為私人存放庫。 默認為 false (亦即 public)。 布爾 (bool)
擁有者 新產生的存放庫擁有者。 字串
repositoryName (儲存庫名稱) 新產生的存放庫名稱。 字串
templateRepositoryUrl 的 範本存放庫的 URL。 新產生的存放庫將會以此存放庫為基礎。 字串

UserAssignedIdentity

名字 描述 價值