共用方式為


az webapp auth

Note

此命令群組具有 Azure CLI 和至少一個擴充功能中定義的命令。 安裝每個擴充功能以受益於其擴充功能。 深入了解擴充功能。

管理 Webapp 驗證和授權。 若要使用 v2 驗證命令,請執行 「az extension add --name authV2」 以新增 authV2 CLI 擴充功能。

命令

名稱 Description 類型 狀態
az webapp auth apple

管理 Apple 識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth apple show

顯示 Apple 識別提供者的驗證設定。

Extension GA
az webapp auth apple update

更新Apple識別提供者的用戶端識別碼和客戶端密碼。

Extension GA
az webapp auth config-version

管理 Webapp 驗證設定的組態版本狀態。 組態版本 v1 是指 /authSettings 端點,而 v2 則是指 /authSettingsV2 端點。

Extension GA
az webapp auth config-version revert

將 Webapp 的組態版本從 v2 還原為 v1(傳統版)。

Extension GA
az webapp auth config-version show

顯示 Webapp 的驗證設定組態版本。 組態版本 v1 是指 /authSettings 端點,而 v2 則是指 /authSettingsV2 端點。

Extension GA
az webapp auth config-version upgrade

將 Webapp 的組態版本從 v1(傳統)升級至 v2。

Extension GA
az webapp auth facebook

管理 Facebook 身分識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth facebook show

顯示Facebook識別提供者的驗證設定。

Extension GA
az webapp auth facebook update

更新 Facebook 身分識別提供者的應用程式識別碼和應用程式密碼。

Extension GA
az webapp auth github

管理 GitHub 識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth github show

顯示 GitHub 識別提供者的驗證設定。

Extension GA
az webapp auth github update

更新 GitHub 識別提供者的用戶端識別碼和客戶端密碼。

Extension GA
az webapp auth google

管理 Google 身分識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth google show

顯示Google識別提供者的驗證設定。

Extension GA
az webapp auth google update

更新Google身分識別提供者的用戶端標識碼和客戶端密碼。

Extension GA
az webapp auth microsoft

管理Microsoft識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth microsoft show

顯示 Azure Active Directory 識別提供者的驗證設定。

Extension GA
az webapp auth microsoft update

更新 Azure Active Directory 識別提供者的用戶端識別碼和客戶端密碼。

Extension GA
az webapp auth openid-connect

管理自訂 OpenID Connect 識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth openid-connect add

設定新的自定義 OpenID Connect 識別提供者。

Extension GA
az webapp auth openid-connect remove

拿掉現有的自定義 OpenID Connect 識別提供者。

Extension GA
az webapp auth openid-connect show

顯示自定義 OpenID Connect 識別提供者的驗證設定。

Extension GA
az webapp auth openid-connect update

更新現有自定義 OpenID Connect 識別提供者的用戶端識別碼和客戶端密碼設定名稱。

Extension GA
az webapp auth set

以 v2 格式設定 Webapp 的驗證設定,並覆寫任何現有的設定。

Extension GA
az webapp auth show

顯示 Webapp 的驗證設定。

Core GA
az webapp auth show (authV2 擴充功能)

以 v2 格式顯示 Webapp 的驗證設定。

Extension GA
az webapp auth twitter

管理 Twitter 識別提供者的 Webapp 驗證和授權。

Extension GA
az webapp auth twitter show

顯示 Twitter 識別提供者的驗證設定。

Extension GA
az webapp auth twitter update

更新 Twitter 身分識別提供者的取用者密鑰和取用者密碼。

Extension GA
az webapp auth update

更新 Webapp 的驗證設定。

Core GA
az webapp auth update (authV2 擴充功能)

以 v2 格式更新 Webapp 的驗證設定。

Extension GA

az webapp auth set

以 v2 格式設定 Webapp 的驗證設定,並覆寫任何現有的設定。

az webapp auth set [--body]
                   [--ids]
                   [--name]
                   [--resource-group]
                   [--slot]
                   [--subscription]

範例

將儲存在檔案中的 json 設定 auth.json 為 Web 應用程式的驗證設定,並覆寫任何現有的設定。

az webapp auth set -g myResourceGroup --name MyWebApp --body @auth.json

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--body -b

Azure App Service 驗證/授權 V2 功能的組態設定 JSON 表示法。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

屬性
參數群組: Resource Id Arguments
--name -n

Web 應用程式的名稱。

屬性
參數群組: Resource Id Arguments
--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

屬性
參數群組: Resource Id Arguments
--slot -s

位置的名稱。 如果未指定,則預設為生產位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

屬性
參數群組: Resource Id Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az webapp auth show

顯示 Webapp 的驗證設定。

az webapp auth show [--ids]
                    [--name]
                    [--resource-group]
                    [--slot]
                    [--subscription]

範例

顯示 Webapp 的驗證設定。 (autogenerated)

az webapp auth show --name MyWebApp --resource-group MyResourceGroup

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

屬性
參數群組: Resource Id Arguments
--name -n

Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>

屬性
參數群組: Resource Id Arguments
--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

屬性
參數群組: Resource Id Arguments
--slot -s

位置的名稱。 如果未指定,則預設為生產位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

屬性
參數群組: Resource Id Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az webapp auth show (authV2 擴充功能)

以 v2 格式顯示 Webapp 的驗證設定。

az webapp auth show [--ids]
                    [--name]
                    [--resource-group]
                    [--slot]
                    [--subscription]

範例

顯示 Webapp 的驗證設定。 (autogenerated)

az webapp auth show --name MyWebApp --resource-group MyResourceGroup

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

屬性
參數群組: Resource Id Arguments
--name -n

Web 應用程式的名稱。

屬性
參數群組: Resource Id Arguments
--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

屬性
參數群組: Resource Id Arguments
--slot -s

位置的名稱。 如果未指定,則預設為生產位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

屬性
參數群組: Resource Id Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az webapp auth update

更新 Webapp 的驗證設定。

az webapp auth update [--aad-allowed-token-audiences]
                      [--aad-client-id]
                      [--aad-client-secret]
                      [--aad-client-secret-certificate-thumbprint --thumbprint]
                      [--aad-token-issuer-url]
                      [--action {AllowAnonymous, LoginWithAzureActiveDirectory, LoginWithFacebook, LoginWithGoogle, LoginWithMicrosoftAccount, LoginWithTwitter}]
                      [--allowed-external-redirect-urls]
                      [--enabled {false, true}]
                      [--facebook-app-id]
                      [--facebook-app-secret]
                      [--facebook-oauth-scopes]
                      [--google-client-id]
                      [--google-client-secret]
                      [--google-oauth-scopes]
                      [--ids]
                      [--microsoft-account-client-id]
                      [--microsoft-account-client-secret]
                      [--microsoft-account-oauth-scopes]
                      [--name]
                      [--resource-group]
                      [--runtime-version]
                      [--slot]
                      [--subscription]
                      [--token-refresh-extension-hours]
                      [--token-store {false, true}]
                      [--twitter-consumer-key]
                      [--twitter-consumer-secret]

範例

啟用驗證並設定 AAD 相關參數,以啟用 AAD。 預設提供者設定為 AAD。 必須事先建立 AAD 服務主體。

az webapp auth update  -g myResourceGroup -n myUniqueApp --enabled true \
  --action LoginWithAzureActiveDirectory \
  --aad-allowed-token-audiences https://webapp_name.azurewebsites.net/.auth/login/aad/callback \
  --aad-client-id ecbacb08-df8b-450d-82b3-3fced03f2b27 --aad-client-secret very_secret_password \
  --aad-token-issuer-url https://sts.windows.net/54826b22-38d6-4fb2-bad9-b7983a3e9c5a/

設定 FB 相關聯的參數並開啟公用配置檔和電子郵件範圍,以允許 Facebook 驗證;允許匿名使用者

az webapp auth update -g myResourceGroup -n myUniqueApp --action AllowAnonymous \
  --facebook-app-id my_fb_id --facebook-app-secret my_fb_secret \
  --facebook-oauth-scopes public_profile email

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--aad-allowed-token-audiences

一或多個令牌物件(以逗號分隔)。

屬性
參數群組: Azure Active Directory Arguments
--aad-client-id

將 AAD 組織帳戶登入整合到 Web 應用程式的應用程式識別碼。

屬性
參數群組: Azure Active Directory Arguments
--aad-client-secret

AAD 應用程式秘密。

屬性
參數群組: Azure Active Directory Arguments
--aad-client-secret-certificate-thumbprint --thumbprint

替代 AAD 用戶端密碼,用於簽署目的的憑證指紋。

屬性
參數群組: Azure Active Directory Arguments
--aad-token-issuer-url

您可以在使用 tenantID 從 Active Directory 端點傳回的 JSON 輸出中找到此 URL。 您可以從 「endpoints.activeDirectory」 的 az cloud show 查詢端點。 您可以使用 az account show找到 tenantID。 從 JSON 取得位於 <active directory endpoint>/<tenantId>/.well-known/openid-configuration的「簽發者」。

屬性
參數群組: Azure Active Directory Arguments
--action
屬性
接受的值: AllowAnonymous, LoginWithAzureActiveDirectory, LoginWithFacebook, LoginWithGoogle, LoginWithMicrosoftAccount, LoginWithTwitter
--allowed-external-redirect-urls

一或多個 URL(空格分隔)。

--enabled
屬性
接受的值: false, true
--facebook-app-id

將 Facebook 登入整合到 Web 應用程式的應用程式識別碼。

屬性
參數群組: Facebook Arguments
--facebook-app-secret

Facebook 應用程式客戶端密碼。

屬性
參數群組: Facebook Arguments
--facebook-oauth-scopes

一或多個facebook驗證範圍(以逗號分隔)。

屬性
參數群組: Facebook Arguments
--google-client-id

將Google登入整合到 Web 應用程式的應用程式識別碼。

屬性
參數群組: Google Arguments
--google-client-secret

Google Application 客戶端密碼。

屬性
參數群組: Google Arguments
--google-oauth-scopes

一或多個Google驗證範圍(以空格分隔)。

屬性
參數群組: Google Arguments
--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

屬性
參數群組: Resource Id Arguments
--microsoft-account-client-id

AAD V2 應用程式識別碼,可將Microsoft帳戶登入整合到您的 Web 應用程式中。

屬性
參數群組: Microsoft Arguments
--microsoft-account-client-secret

AAD V2 應用程式客戶端密碼。

屬性
參數群組: Microsoft Arguments
--microsoft-account-oauth-scopes

一或多個Microsoft驗證範圍(以逗號分隔)。

屬性
參數群組: Microsoft Arguments
--name -n

Web 應用程式的名稱。 如果未指定,則會隨機產生名稱。 您可以使用 來設定預設值 az configure --defaults web=<name>

屬性
參數群組: Resource Id Arguments
--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

屬性
參數群組: Resource Id Arguments
--runtime-version

用於目前應用程式的驗證/授權功能的運行時間版本。

--slot -s

位置的名稱。 如果未指定,則預設為生產位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

屬性
參數群組: Resource Id Arguments
--token-refresh-extension-hours

小時,必須可格式化為浮點數。

--token-store

使用 App Service 令牌存放區。

屬性
接受的值: false, true
--twitter-consumer-key

將 Twitter 登入整合到 Web 應用程式的應用程式識別碼。

屬性
參數群組: Twitter Arguments
--twitter-consumer-secret

Twitter 應用程式客戶端密碼。

屬性
參數群組: Twitter Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False

az webapp auth update (authV2 擴充功能)

以 v2 格式更新 Webapp 的驗證設定。

az webapp auth update [--action --unauthenticated-client-action {AllowAnonymous, RedirectToLoginPage, Return401, Return403, Return404}]
                      [--config-file-path]
                      [--custom-host-header --proxy-custom-host-header]
                      [--custom-proto-header --proxy-custom-proto-header]
                      [--enable-token-store {false, true}]
                      [--enabled {false, true}]
                      [--excluded-paths]
                      [--ids]
                      [--name]
                      [--proxy-convention {Custom, NoProxy, Standard}]
                      [--redirect-provider]
                      [--require-https {false, true}]
                      [--resource-group]
                      [--runtime-version]
                      [--set]
                      [--slot]
                      [--subscription]

範例

更新已設定之 AAD 提供者的用戶端標識碼

az webapp auth update -g myResourceGroup --name MyWebApp --set identityProviders.azureActiveDirectory.registration.clientId=my-client-id

將應用程式的運行時間版本釘選到 1.4.7

az webapp auth update -g myResourceGroup --name MyWebApp --runtime-version 1.4.7

藉由設定組態檔路徑,以檔案型驗證來設定應用程式

az webapp auth update -g myResourceGroup --name MyWebApp --config-file-path D:\home\site\wwwroot\auth.json

將應用程式設定為允許未經驗證的要求叫用應用程式。

az webapp auth update -g myResourceGroup --name MyWebApp --unauthenticated-client-action AllowAnonymous

將應用程式設定為將未經驗證的要求重新導向至 Facebook 提供者

az webapp auth update -g myResourceGroup --name MyWebApp --redirect-provider Facebook

將應用程式設定為接聽正向標頭 X-FORWARDED-HOST 和 X-FORWARDED-PROTO

az webapp auth update -g myResourceGroup --name MyWebApp --proxy-convention Standard

選擇性參數

下列參數是選擇性參數,但視內容而定,命令可能需要一或多個參數才能成功執行。

--action --unauthenticated-client-action

當未經驗證的客戶端嘗試存取應用程式時要採取的動作。

屬性
接受的值: AllowAnonymous, RedirectToLoginPage, Return401, Return403, Return404
--config-file-path

如果組態檔來自檔案,則包含驗證設定的路徑。

--custom-host-header --proxy-custom-host-header

包含要求主機的標頭名稱。

--custom-proto-header --proxy-custom-proto-header

包含要求配置之標頭的名稱。

--enable-token-store

True 是表示 可永久儲存在登入流程期間取得的平臺特定安全性令牌;否則為 false。

屬性
接受的值: false, true
--enabled

如果目前應用程式已啟用驗證/授權功能,則為 True;否則為 false。

屬性
接受的值: false, true
--excluded-paths

應從驗證規則中排除的路徑清單。

--ids

一或多個資源識別碼(以空格分隔)。 它應該是包含 「資源標識碼」自變數所有資訊的完整資源識別碼。 您應該提供 --ids 或其他「資源識別碼」自變數。

屬性
參數群組: Resource Id Arguments
--name -n

Web 應用程式的名稱。

屬性
參數群組: Resource Id Arguments
--proxy-convention

用來判斷所提出要求 URL 的慣例。

屬性
接受的值: Custom, NoProxy, Standard
--redirect-provider

設定多個提供者時要使用的預設驗證提供者。

--require-https

如果不允許驗證/授權回應沒有 HTTPS 配置,則為 False;否則為 true。

屬性
接受的值: false, true
--resource-group -g

資源組名。 您可以使用 az configure --defaults group=<name>來設定預設群組。

屬性
參數群組: Resource Id Arguments
--runtime-version

用於目前應用程式的驗證/授權功能的 RuntimeVersion。

--set

Azure App Service 驗證/授權 V2 功能組態設定中特定欄位的值。

--slot -s

位置的名稱。 如果未指定,則預設為生產位置。

--subscription

訂用帳戶的名稱或標識碼。 您可以使用 az account set -s NAME_OR_ID來設定預設訂用帳戶。

屬性
參數群組: Resource Id Arguments
全域參數
--debug

提高日誌詳細程度以顯示所有調試日誌。

屬性
預設值: False
--help -h

顯示此說明訊息並結束。

--only-show-errors

只顯示錯誤,隱藏警告。

屬性
預設值: False
--output -o

輸出格式。

屬性
預設值: json
接受的值: json, jsonc, none, table, tsv, yaml, yamlc
--query

JMESPath 查詢字串。 如需詳細資訊和範例,請參閱 http://jmespath.org/

--verbose

增加記錄的詳細程度。 針對完整偵錯記錄使用 --debug。

屬性
預設值: False