az webapp config access-restriction
顯示、設定、新增和移除 Webapp 存取限制的方法。
命令
| 名稱 | Description | 類型 | 狀態 |
|---|---|---|---|
| az webapp config access-restriction add |
將存取限制新增至 Webapp。 |
Core | GA |
| az webapp config access-restriction remove |
從 Webapp 移除存取限制。 |
Core | GA |
| az webapp config access-restriction set |
設定 SCM 網站是否使用與主要月台和預設動作相同的限制。 |
Core | GA |
| az webapp config access-restriction show |
顯示 Webapp 的存取限制設定。 |
Core | GA |
az webapp config access-restriction add
將存取限制新增至 Webapp。
az webapp config access-restriction add --priority
[--action {Allow, Deny}]
[--description]
[--http-headers]
[--ids]
[--ignore-missing-endpoint {false, true}]
[--ip-address]
[--name]
[--resource-group]
[--rule-name]
[--scm-site {false, true}]
[--service-tag]
[--skip-service-tag-validation {false, true}]
[--slot]
[--subnet]
[--subscription]
[--vnet-name]
[--vnet-resource-group]
範例
為 IPv4 位址 130.220.0.0/27 新增名為開發人員且優先順序為 200 主網站的存取限制開啟(允許)。
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name developers --action Allow --ip-address 130.220.0.0/27 --priority 200
為 IPv4 位址 192.168.0.0/27 新增名為 build_server 且優先順序為 250 的存取限制開啟(允許)。
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name build_server --action Allow --ip-address 192.168.0.0/27 --priority 250 --scm-site true
在 vNet core_weu中,針對子網app_gw新增名為 app_gateway 且優先順序為 300 的主月臺的存取限制開啟(允許)。
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name app_gateway --action Allow --vnet-name core_weu --subnet app_gateway --priority 300
在 vNet corp01 中,將名為 internal_agents 的存取限制開啟 (允許) 新增名為 internal_agents build_agents 的 vNet corp01 中,優先順序為 500 至 scm 網站;並忽略子網上的服務端點註冊。
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name internal_agents --action Allow --vnet-name corp01 --subnet build_agents --priority 500 --scm-site true --ignore-missing-endpoint true
在具有子網 'agents' 的 vNet 'corp01' 中新增名為 remote_agents的存取限制開啟 (允許)
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name remote_agents --action Allow --vnet-name corp01 --subnet agents --priority 500 --vnet-resource-group vnets
在 rg 'vnets' 中新增具有子網 'agents' 的 vNet 'corp01' 中具名代理程式的存取限制開啟 (允許) (使用子網資源標識符)
az webapp config access-restriction add -g ResourceGroup -n AppName --rule-name remote_agents --action Allow --priority 800 --subnet '/subscriptions/<subscription-id>/resourceGroups/vnets/providers/Microsoft.Network/virtualNetworks/corp01/subnets/agents'
新增沒有服務標籤 AzureCloud 規則名稱的存取限制開啟 (允許)
az webapp config access-restriction add -g ResourceGroup -n AppName --priority 400 --service-tag AzureCloud
新增沒有服務標籤 AzureFrontDoor.Backend 和 http-header X-Azure-FDID 且值為 '12345678-abcd-1234-abcd-12345678910a' 的存取限制開啟 (允許)
az webapp config access-restriction add -g ResourceGroup -n AppName --priority 400 --service-tag AzureFrontDoor.Backend --http-header x-azure-fdid=12345678-abcd-1234-abcd-12345678910a
針對相同標頭 'X-Azure-FDID' 新增具有多個 http 標頭值的存取限制開啟 (允許)
az webapp config access-restriction add -g ResourceGroup -n AppName --priority 400 --service-tag AzureFrontDoor.Backend --http-header x-azure-fdid=12345678-abcd-1234-abcd-12345678910a x-azure-fdid=11111111-abcd-1234-abcd-222222222222
必要參數
存取限制規則的優先順序。
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
允許或拒絕存取。
| 屬性 | 值 |
|---|---|
| 預設值: | Allow |
| 接受的值: | Allow, Deny |
存取限制規則的描述。
以 <name>=<value>格式分隔的空間分隔 HTTP 標頭。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
建立存取限制規則,檢查子網是否已啟用 Microsoft.Web 服務端點。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
| 接受的值: | false, true |
IP 位址或 CIDR 範圍(選擇性的逗號分隔清單最多 8 個範圍)。
Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
要新增的存取限制規則名稱。
如果 scm 網站已新增存取限制,則為 True。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
| 接受的值: | false, true |
服務標籤(最多 8 個標籤的選擇性逗號分隔清單)。
略過驗證公用服務標籤。
| 屬性 | 值 |
|---|---|
| 接受的值: | false, true |
位置的名稱。 如果未指定,則預設為生產位置。
子網名稱(需要 vNet 名稱)或子網資源標識碼。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
VNet 名稱。
虛擬網路的資源群組(預設為 Web 應用程式資源群組)。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az webapp config access-restriction remove
從 Webapp 移除存取限制。
az webapp config access-restriction remove [--action {Allow, Deny}]
[--ids]
[--ip-address]
[--name]
[--resource-group]
[--rule-name]
[--scm-site {false, true}]
[--service-tag]
[--skip-service-tag-validation {false, true}]
[--slot]
[--subnet]
[--subscription]
[--vnet-name]
範例
從主要網站移除名為 開發人員的存取限制。
az webapp config access-restriction remove -g ResourceGroup -n AppName --rule-name developers
從 scm 網站移除名為 internal_agents 的存取限制。
az webapp config access-restriction remove -g ResourceGroup -n AppName --rule-name internal_agents --scm-site true
從主要網站移除服務標籤 AzureFrontDoor.Backend 的存取限制。
az webapp config access-restriction remove -g ResourceGroup -n AppName --service-tag AzureFrontDoor.Backend
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
允許或拒絕存取。
| 屬性 | 值 |
|---|---|
| 預設值: | Allow |
| 接受的值: | Allow, Deny |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
IP 位址或 CIDR 範圍(選擇性的逗號分隔清單最多 8 個範圍)。
Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
要移除的存取限制名稱。
True 是表示 如果應該從 scm 網站移除存取限制。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
| 接受的值: | false, true |
服務標籤(最多 8 個標籤的選擇性逗號分隔清單)。
略過驗證公用服務標籤。
| 屬性 | 值 |
|---|---|
| 接受的值: | false, true |
位置的名稱。 如果未指定,則預設為生產位置。
子網名稱(需要 vNet 名稱)或子網資源標識碼。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
VNet 名稱。
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az webapp config access-restriction set
設定 SCM 網站是否使用與主要月台和預設動作相同的限制。
az webapp config access-restriction set [--default-action {Allow, Deny}]
[--ids]
[--name]
[--resource-group]
[--scm-default-action {Allow, Deny}]
[--slot]
[--subscription]
[--use-same-restrictions-for-scm-site {false, true}]
範例
啟用 SCM 網站,以使用與主要月臺相同的存取限制。
az webapp config access-restriction set -g ResourceGroup -n AppName --use-same-restrictions-for-scm-site true
將預設動作設定為 [允許主要網站]。
az webapp config access-restriction set -g ResourceGroup -n AppName --default-action Allow
將 scm 網站的預設動作設定為 Deny。
az webapp config access-restriction set -g ResourceGroup -n AppName --scm-default-action Deny
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
設定主要月臺的預設動作。
| 屬性 | 值 |
|---|---|
| 接受的值: | Allow, Deny |
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
設定 scm 月臺的預設動作。
| 屬性 | 值 |
|---|---|
| 接受的值: | Allow, Deny |
位置的名稱。 如果未指定,則預設為生產位置。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
針對 scm 網站使用相同的存取限制。
| 屬性 | 值 |
|---|---|
| 接受的值: | false, true |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
az webapp config access-restriction show
顯示 Webapp 的存取限制設定。
az webapp config access-restriction show [--ids]
[--name]
[--resource-group]
[--slot]
[--subscription]
範例
取得 Webapp 的存取限制設定。
az webapp config access-restriction show -g ResourceGroup -n AppName
選擇性參數
下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。
一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
位置的名稱。 如果未指定,則預設為生產位置。
訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。
| 屬性 | 值 |
|---|---|
| 參數群組: | Resource Id Arguments |
全域參數
提高日誌詳細程度以顯示所有調試日誌。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
顯示此說明訊息並結束。
只顯示錯誤,隱藏警告。
| 屬性 | 值 |
|---|---|
| 預設值: | False |
輸出格式。
| 屬性 | 值 |
|---|---|
| 預設值: | json |
| 接受的值: | json, jsonc, none, table, tsv, yaml, yamlc |
JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/。
增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。
| 屬性 | 值 |
|---|---|
| 預設值: | False |