Share via


Web Apps - Update Auth Settings

匯報與 Web 應用程式相關聯的驗證/授權設定的描述。

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettings?api-version=2023-12-01

URI 參數

名稱 位於 必要 類型 Description
name
path True

string

Web 應用程式的名稱。

resourceGroupName
path True

string

資源所屬資源群組的名稱。

Regex pattern: ^[-\w\._\(\)]+[^\.]$

subscriptionId
path True

string

您的 Azure 訂用帳戶識別碼。 這是 GUID 格式的字串 (例如 000000000-0000-0000-0000-000000000000) 。

api-version
query True

string

API 版本

要求本文

名稱 類型 Description
kind

string

資源種類。

properties.aadClaimsAuthorization

string

取得包含 Azure AD Acl 設定的 JSON 字串。

properties.additionalLoginParams

string[]

當使用者登入時,要傳送至 OpenID Connect 授權端點的登入參數。 每個參數的格式都必須是 「key=value」。。

properties.allowedAudiences

string[]

允許的物件值在驗證 Azure Active Directory 所簽發的 JSON Web 令牌時考慮。 請注意,不論此設定為何,值 ClientID 一律被視為允許的物件。

properties.allowedExternalRedirectUrls

string[]

可在登入或註銷應用程式時重新導向至 的外部URL。 請注意,會忽略 URL 的查詢字串部分。 這是 Windows 市集應用程式後端通常需要的進階設定。 請注意,目前網域內的URL一律會隱含允許。

properties.authFilePath

string

包含驗證設定的組態檔路徑。 如果路徑是相對的,基底將會是月臺的根目錄。

properties.clientId

string

此信賴憑證者應用程式的用戶端標識碼,稱為client_id。 若要使用 Azure Active Directory 或其他第三方 OpenID Connect 提供者啟用 OpenID 連線驗證,則需要此設定。 OpenID Connect 的詳細資訊: http://openid.net/specs/openid-connect-core-1_0.html

properties.clientSecret

string

Azure Active Directory 中此信賴憑證者應用程式的用戶端密碼 (,也稱為密鑰) 。 這個設定是選擇性的。 如果未設定任何客戶端密碼,則會使用 OpenID Connect 隱含驗證流程來驗證終端使用者。 否則,OpenID Connect 授權碼流程會用來驗證使用者。 OpenID Connect 的詳細資訊: http://openid.net/specs/openid-connect-core-1_0.html

properties.clientSecretCertificateThumbprint

string

客戶端密碼的替代方案,這是用於簽署之憑證的指紋。 這個屬性可作為客戶端密碼的取代。 它也是選擇性的。

properties.clientSecretSettingName

string

包含信賴憑證者應用程式的用戶端密碼的應用程式設定名稱。

properties.configVersion

string

目前應用程式使用的驗證/授權功能的 ConfigVersion。 此值中的設定可以控制驗證/授權的控制平面行為。

properties.defaultProvider

BuiltInAuthenticationProvider

設定多個提供者時要使用的預設驗證提供者。 只有在設定多個提供者且未驗證的客戶端動作設定為 “RedirectToLoginPage” 時,才需要此設定。

properties.enabled

boolean

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

properties.facebookAppId

string

用於登入之 Facebook 應用程式的應用程式標識碼。 啟用 Facebook Login 需要此設定。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.facebookAppSecret

string

用於 Facebook 登入之 Facebook 應用程式的應用程式秘密。 啟用 Facebook Login 需要此設定。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.facebookAppSecretSettingName

string

應用程式設定名稱,其中包含用於登入 Facebook 的應用程式密碼。

properties.facebookOAuthScopes

string[]

將作為 Facebook 登入驗證一部分要求的 OAuth 2.0 範圍。 這個設定是選擇性的。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.gitHubClientId

string

用於登入的 GitHub 應用程式的用戶端識別碼。 啟用 Github 登入需要此設定

properties.gitHubClientSecret

string

GitHub 應用程式用於 Github 登入的客戶端密碼。 啟用 Github 登入需要此設定。

properties.gitHubClientSecretSettingName

string

應用程式設定名稱,其中包含用於 GitHub 登入之 Github 應用程式的客戶端密碼。

properties.gitHubOAuthScopes

string[]

將作為 GitHub 登入驗證一部分要求的 OAuth 2.0 範圍。 此設定是選擇性的

properties.googleClientId

string

Google Web 應用程式的 OpenID Connect 用戶端識別碼。 啟用Google登入需要此設定。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.googleClientSecret

string

與Google Web 應用程式相關聯的客戶端密碼。 啟用Google登入需要此設定。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.googleClientSecretSettingName

string

應用程式設定名稱,其中包含與 Google Web 應用程式相關聯的客戶端密碼。

properties.googleOAuthScopes

string[]

將作為Google Sign-In 驗證一部分要求的OAuth 2.0範圍。 這個設定是選擇性的。 如果未指定,則會使用 「openid」、“profile」 和 「email」 作為預設範圍。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.isAuthFromFile

string

如果應該從檔案讀取驗證組態設定,則為 “true”,否則為 “false”

properties.issuer

string

OpenID Connect 簽發者 URI,代表發出此應用程式存取令牌的實體。 使用 Azure Active Directory 時,此值是目錄租使用者的 URI,例如 https://sts.windows.net/{tenant-guid}/。 此 URI 是令牌簽發者的區分大小寫標識碼。 OpenID Connect 探索的詳細資訊: http://openid.net/specs/openid-connect-discovery-1_0.html

properties.microsoftAccountClientId

string

針對用於驗證的應用程式所建立的 OAuth 2.0 用戶端識別碼。 啟用 Microsoft 帳戶驗證需要此設定。 Microsoft 帳戶 OAuth 檔: https://dev.onedrive.com/auth/msa_oauth.htm

properties.microsoftAccountClientSecret

string

針對用於驗證的應用程式所建立的 OAuth 2.0 客戶端密碼。 啟用 Microsoft 帳戶驗證需要此設定。 Microsoft 帳戶 OAuth 檔: https://dev.onedrive.com/auth/msa_oauth.htm

properties.microsoftAccountClientSecretSettingName

string

應用程式設定名稱,其中包含針對用於驗證之應用程式所建立的 OAuth 2.0 客戶端密碼。

properties.microsoftAccountOAuthScopes

string[]

將作為 Microsoft 帳戶驗證一部分要求的 OAuth 2.0 範圍。 這個設定是選擇性的。 如果未指定,則會使用 「wl.basic」 作為預設範圍。 Microsoft 帳戶範圍和許可權檔: https://msdn.microsoft.com/en-us/library/dn631845.aspx

properties.runtimeVersion

string

用於目前應用程式的 Authentication /Authorization 功能的 RuntimeVersion。 此值中的設定可以控制驗證/授權模組中特定功能的行為。

properties.tokenRefreshExtensionHours

number

會話令牌到期后的小時數,會話令牌可用來呼叫令牌重新整理 API。 預設值為 72 小時。

properties.tokenStoreEnabled

boolean

true 若要永久儲存在登入流程期間取得的平臺特定安全性令牌;否則為 false。 預設為 false

properties.twitterConsumerKey

string

用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者密鑰。 啟用 Twitter 登入需要此設定。 Twitter Sign-In 檔: https://dev.twitter.com/web/sign-in

properties.twitterConsumerSecret

string

用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者秘密。 啟用 Twitter 登入需要此設定。 Twitter Sign-In 檔: https://dev.twitter.com/web/sign-in

properties.twitterConsumerSecretSettingName

string

應用程式設定名稱,其中包含用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者密碼。

properties.unauthenticatedClientAction

UnauthenticatedClientAction

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

properties.validateIssuer

boolean

取得值,指出簽發者是否應該是有效的 HTTPS URL,並驗證如下。

回應

名稱 類型 Description
200 OK

SiteAuthSettings

確定

Other Status Codes

DefaultErrorResponse

App Service 錯誤回應。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

名稱 Description
user_impersonation 模擬您的用戶帳戶

範例

Update Auth Settings

Sample Request

PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141/config/authsettings?api-version=2023-12-01

{
  "properties": {
    "enabled": true,
    "runtimeVersion": "~1",
    "unauthenticatedClientAction": "RedirectToLoginPage",
    "tokenStoreEnabled": true,
    "allowedExternalRedirectUrls": [
      "sitef6141.customdomain.net",
      "sitef6141.customdomain.info"
    ],
    "defaultProvider": "Google",
    "tokenRefreshExtensionHours": 120,
    "clientId": "42d795a9-8abb-4d06-8534-39528af40f8e.apps.googleusercontent.com"
  }
}

Sample Response

{
  "id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141/config/authsettings",
  "name": "authsettings",
  "type": "Microsoft.Web/sites/authsettings",
  "kind": "app",
  "properties": {
    "enabled": true,
    "runtimeVersion": "~1",
    "unauthenticatedClientAction": "RedirectToLoginPage",
    "tokenStoreEnabled": true,
    "allowedExternalRedirectUrls": [
      "sitef6141.customdomain.net",
      "sitef6141.customdomain.info"
    ],
    "defaultProvider": "Google",
    "tokenRefreshExtensionHours": 120,
    "clientId": "42d795a9-8abb-4d06-8534-39528af40f8e.apps.googleusercontent.com"
  }
}

定義

名稱 Description
BuiltInAuthenticationProvider

設定多個提供者時要使用的預設驗證提供者。 只有在設定多個提供者且未驗證的客戶端動作設定為 “RedirectToLoginPage” 時,才需要此設定。

DefaultErrorResponse

App Service 錯誤回應。

Details
Error

錯誤模型。

SiteAuthSettings

Azure App 服務 驗證/授權功能的組態設定。

UnauthenticatedClientAction

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

BuiltInAuthenticationProvider

設定多個提供者時要使用的預設驗證提供者。 只有在設定多個提供者且未驗證的客戶端動作設定為 “RedirectToLoginPage” 時,才需要此設定。

名稱 類型 Description
AzureActiveDirectory

string

Facebook

string

Github

string

Google

string

MicrosoftAccount

string

Twitter

string

DefaultErrorResponse

App Service 錯誤回應。

名稱 類型 Description
error

Error

錯誤模型。

Details

名稱 類型 Description
code

string

標準化字串,以程序設計方式識別錯誤。

message

string

詳細的錯誤描述和偵錯資訊。

target

string

詳細的錯誤描述和偵錯資訊。

Error

錯誤模型。

名稱 類型 Description
code

string

標準化字串,以程序設計方式識別錯誤。

details

Details[]

詳細的錯誤。

innererror

string

偵錯錯誤的詳細資訊。

message

string

詳細的錯誤描述和偵錯資訊。

target

string

詳細的錯誤描述和偵錯資訊。

SiteAuthSettings

Azure App 服務 驗證/授權功能的組態設定。

名稱 類型 Description
id

string

資源標識碼。

kind

string

資源種類。

name

string

資源名稱。

properties.aadClaimsAuthorization

string

取得包含 Azure AD Acl 設定的 JSON 字串。

properties.additionalLoginParams

string[]

當使用者登入時,要傳送至 OpenID Connect 授權端點的登入參數。 每個參數的格式都必須是 「key=value」。。

properties.allowedAudiences

string[]

允許的物件值在驗證 Azure Active Directory 所簽發的 JSON Web 令牌時考慮。 請注意,不論此設定為何,值 ClientID 一律被視為允許的物件。

properties.allowedExternalRedirectUrls

string[]

可在登入或註銷應用程式時重新導向至 的外部URL。 請注意,會忽略 URL 的查詢字串部分。 這是 Windows 市集應用程式後端通常需要的進階設定。 請注意,目前網域內的URL一律會隱含允許。

properties.authFilePath

string

包含驗證設定的組態檔路徑。 如果路徑是相對的,基底將會是月臺的根目錄。

properties.clientId

string

此信賴憑證者應用程式的用戶端標識碼,稱為client_id。 若要使用 Azure Active Directory 或其他第三方 OpenID Connect 提供者啟用 OpenID 連線驗證,則需要此設定。 OpenID Connect 的詳細資訊: http://openid.net/specs/openid-connect-core-1_0.html

properties.clientSecret

string

Azure Active Directory 中此信賴憑證者應用程式的用戶端密碼 (,也稱為密鑰) 。 這個設定是選擇性的。 如果未設定任何客戶端密碼,則會使用 OpenID Connect 隱含驗證流程來驗證終端使用者。 否則,OpenID Connect 授權碼流程會用來驗證使用者。 OpenID Connect 的詳細資訊: http://openid.net/specs/openid-connect-core-1_0.html

properties.clientSecretCertificateThumbprint

string

客戶端密碼的替代方案,這是用於簽署之憑證的指紋。 這個屬性可作為客戶端密碼的取代。 它也是選擇性的。

properties.clientSecretSettingName

string

包含信賴憑證者應用程式的用戶端密碼的應用程式設定名稱。

properties.configVersion

string

目前應用程式使用的驗證/授權功能的 ConfigVersion。 此值中的設定可以控制驗證/授權的控制平面行為。

properties.defaultProvider

BuiltInAuthenticationProvider

設定多個提供者時要使用的預設驗證提供者。 只有在設定多個提供者且未驗證的客戶端動作設定為 “RedirectToLoginPage” 時,才需要此設定。

properties.enabled

boolean

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

properties.facebookAppId

string

用於登入之 Facebook 應用程式的應用程式標識碼。 啟用 Facebook 登入時,需要此設定。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.facebookAppSecret

string

用於 Facebook 登入之 Facebook 應用程式的應用程式秘密。 啟用 Facebook 登入時,需要此設定。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.facebookAppSecretSettingName

string

應用程式設定名稱,其中包含用於 Facebook 登入的應用程式密碼。

properties.facebookOAuthScopes

string[]

將要求作為 Facebook 登入驗證一部分的 OAuth 2.0 範圍。 這個設定是選擇性的。 Facebook 登入檔案:https://developers.facebook.com/docs/facebook-login

properties.gitHubClientId

string

用於登入的 GitHub 應用程式的用戶端識別碼。 啟用 Github 登入需要此設定

properties.gitHubClientSecret

string

GitHub 應用程式用於 Github 登入的客戶端密碼。 啟用 Github 登入需要此設定。

properties.gitHubClientSecretSettingName

string

應用程式設定名稱,其中包含用於 GitHub 登入之 Github 應用程式的客戶端密碼。

properties.gitHubOAuthScopes

string[]

將作為 GitHub 登入驗證一部分要求的 OAuth 2.0 範圍。 此設定是選擇性的

properties.googleClientId

string

Google Web 應用程式的 OpenID Connect 用戶端識別碼。 啟用Google登入需要此設定。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.googleClientSecret

string

與Google Web 應用程式相關聯的客戶端密碼。 啟用Google登入需要此設定。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.googleClientSecretSettingName

string

應用程式設定名稱,其中包含與 Google Web 應用程式相關聯的客戶端密碼。

properties.googleOAuthScopes

string[]

將作為Google Sign-In 驗證一部分要求的OAuth 2.0範圍。 這個設定是選擇性的。 如果未指定,則會使用 「openid」、“profile」 和 「email」 作為預設範圍。 Google Sign-In 檔: https://developers.google.com/identity/sign-in/web/

properties.isAuthFromFile

string

如果應該從檔案讀取驗證組態設定,則為 “true”,否則為 “false”

properties.issuer

string

OpenID Connect 簽發者 URI,代表發出此應用程式存取令牌的實體。 使用 Azure Active Directory 時,此值是目錄租使用者的 URI,例如 https://sts.windows.net/{tenant-guid}/。 此 URI 是令牌簽發者的區分大小寫標識碼。 OpenID Connect 探索的詳細資訊: http://openid.net/specs/openid-connect-discovery-1_0.html

properties.microsoftAccountClientId

string

針對用於驗證的應用程式所建立的 OAuth 2.0 用戶端識別碼。 啟用 Microsoft 帳戶驗證需要此設定。 Microsoft 帳戶 OAuth 檔: https://dev.onedrive.com/auth/msa_oauth.htm

properties.microsoftAccountClientSecret

string

針對用於驗證的應用程式所建立的 OAuth 2.0 客戶端密碼。 啟用 Microsoft 帳戶驗證需要此設定。 Microsoft 帳戶 OAuth 檔: https://dev.onedrive.com/auth/msa_oauth.htm

properties.microsoftAccountClientSecretSettingName

string

應用程式設定名稱,其中包含針對用於驗證之應用程式所建立的 OAuth 2.0 客戶端密碼。

properties.microsoftAccountOAuthScopes

string[]

將作為 Microsoft 帳戶驗證一部分要求的 OAuth 2.0 範圍。 這個設定是選擇性的。 如果未指定,則會使用 「wl.basic」 作為預設範圍。 Microsoft 帳戶範圍和許可權檔: https://msdn.microsoft.com/en-us/library/dn631845.aspx

properties.runtimeVersion

string

用於目前應用程式的 Authentication /Authorization 功能的 RuntimeVersion。 此值中的設定可以控制驗證/授權模組中特定功能的行為。

properties.tokenRefreshExtensionHours

number

會話令牌到期后的小時數,會話令牌可用來呼叫令牌重新整理 API。 預設值為 72 小時。

properties.tokenStoreEnabled

boolean

true 若要永久儲存在登入流程期間取得的平臺特定安全性令牌;否則為 false。 預設值為 false

properties.twitterConsumerKey

string

用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者密鑰。 啟用 Twitter 登入需要此設定。 Twitter Sign-In 檔: https://dev.twitter.com/web/sign-in

properties.twitterConsumerSecret

string

用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者秘密。 啟用 Twitter 登入需要此設定。 Twitter Sign-In 檔: https://dev.twitter.com/web/sign-in

properties.twitterConsumerSecretSettingName

string

應用程式設定名稱,其中包含用於登入之 Twitter 應用程式的 OAuth 1.0a 取用者密碼。

properties.unauthenticatedClientAction

UnauthenticatedClientAction

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

properties.validateIssuer

boolean

取得值,指出簽發者是否應該是有效的 HTTPS URL,並驗證如下。

type

string

資源類型。

UnauthenticatedClientAction

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

名稱 類型 Description
AllowAnonymous

string

RedirectToLoginPage

string