你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Web Apps - Update Auth Settings

更新与 Web 应用关联的身份验证/授权设置的说明。

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

URI 参数

名称 必需 类型 说明
name
path True

string

Web 应用的名称。

resourceGroupName
path True

string

minLength: 1
maxLength: 90
pattern: ^[-\w\._\(\)]+[^\.]$

资源所属的资源组的名称。

subscriptionId
path True

string

Azure 订阅 ID。 这是 GUID 格式的字符串(例如 000000000-0000-0000-0000-00000000000000)。

api-version
query True

string

API 版本

请求正文

名称 类型 说明
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

此信赖方应用程序的客户端 ID,称为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 应用的应用 ID。 启用 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 应用的客户端 ID。 启用 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 客户端 ID。 启用 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 客户端 ID。 启用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

用于当前应用的身份验证/授权功能的 RuntimeVersion。 此值中的设置可以控制身份验证/授权模块中某些功能的行为。

properties.tokenRefreshExtensionHours

number (double)

会话令牌过期后的小时数,会话令牌可用于调用令牌刷新 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,并按如下所示进行验证。

响应

名称 类型 说明
200 OK

SiteAuthSettings

还行

Other Status Codes

DefaultErrorResponse

应用服务错误响应。

安全性

azure_auth

Azure Active Directory OAuth2 Flow

类型: oauth2
流向: implicit
授权 URL: https://login.microsoftonline.com/common/oauth2/authorize

作用域

名称 说明
user_impersonation 模拟用户帐户

示例

Update Auth Settings

示例请求

PUT https://management.azure.com/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/sites/sitef6141/config/authsettings?api-version=2024-04-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"
  }
}

示例响应

{
  "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"
  }
}

定义

名称 说明
BuiltInAuthenticationProvider

配置多个提供程序时要使用的默认身份验证提供程序。 仅当配置了多个提供程序并且未经身份验证的客户端操作设置为“RedirectToLoginPage”时,才需要此设置。

DefaultErrorResponse

应用服务错误响应。

Details
Error

错误模型。

SiteAuthSettings

Azure 应用服务身份验证/授权功能的配置设置。

UnauthenticatedClientAction

未经身份验证的客户端尝试访问应用时要执行的操作。

BuiltInAuthenticationProvider

配置多个提供程序时要使用的默认身份验证提供程序。 仅当配置了多个提供程序并且未经身份验证的客户端操作设置为“RedirectToLoginPage”时,才需要此设置。

说明
AzureActiveDirectory
Facebook
Github
Google
MicrosoftAccount
Twitter

DefaultErrorResponse

应用服务错误响应。

名称 类型 说明
error

Error

错误模型。

Details

名称 类型 说明
code

string

标准化字符串,以编程方式标识错误。

message

string

详细的错误说明和调试信息。

target

string

详细的错误说明和调试信息。

Error

错误模型。

名称 类型 说明
code

string

标准化字符串,以编程方式标识错误。

details

Details[]

详细错误。

innererror

string

调试错误的详细信息。

message

string

详细的错误说明和调试信息。

target

string

详细的错误说明和调试信息。

SiteAuthSettings

Azure 应用服务身份验证/授权功能的配置设置。

名称 类型 说明
id

string

资源 ID。

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

此信赖方应用程序的客户端 ID,称为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 应用的应用 ID。 启用 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 应用的客户端 ID。 启用 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 客户端 ID。 启用 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 客户端 ID。 启用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

用于当前应用的身份验证/授权功能的 RuntimeVersion。 此值中的设置可以控制身份验证/授权模块中某些功能的行为。

properties.tokenRefreshExtensionHours

number (double)

会话令牌过期后的小时数,会话令牌可用于调用令牌刷新 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

未经身份验证的客户端尝试访问应用时要执行的操作。

说明
AllowAnonymous
RedirectToLoginPage