删除 phoneAuthenticationMethod
本文内容
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
删除用户的电话 身份验证方法 。
注意: 这将删除用户的电话号码,他们将不再能够使用该号码进行身份验证,无论是通过短信还是语音呼叫。
请记住,用户不能有 alternateMobile 没有数字 mobile 的号码。 如果要从也具有号码的用户中删除号码,请首先将号码更新为新号码,然后 mobile alternateMobile mobile 删除该 alternateMobile 号码。
如果电话号码是用户的默认 Azure 多重身份验证 (MFA) 方法,则不能将其删除。 让用户更改其默认身份验证方法,然后删除该号码。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限 。
自行操作的权限
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
UserAuthenticationMethod.ReadWrite
委派(个人 Microsoft 帐户)
不支持。
应用程序
不支持。
对其他用户操作的权限
权限类型
权限(从最低特权到最高特权)
委派(工作或学校帐户)
UserAuthenticationMethod.ReadWrite.All
委派(个人 Microsoft 帐户)
不支持。
应用程序
UserAuthenticationMethod.ReadWrite.All
对于管理员正在操作其他用户的委派方案,管理员需要以下角色Azure AD之一 :
HTTP 请求
DELETE /me/authentication/phoneMethods/{id}
DELETE /users/{id | userPrincipalName}/authentication/phoneMethods/{id}
与要 id 删除的 phoneType 对应的值是下列值之一:
b6332ec1-7057-4abe-9331-3d72feddfe41 删除 alternateMobile phoneType 。
e37fc753-ff3b-4958-9484-eaa9425c82bc 删除 office phoneType 。
3179e48a-750b-4051-897c-87b9720928f7 删除 mobile phoneType 。
名称
说明
Authorization
Bearer {token}。必需。
请求正文
请勿提供此方法的请求正文。
响应
如果成功,此方法返回 204 No Content 响应代码。它不在响应正文中返回任何内容。
示例
请求
下面展示了示例请求。
DELETE https://graph.microsoft.com/beta/me/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Me.Authentication.PhoneMethods["{phoneAuthenticationMethod-id}"]
.Request()
.DeleteAsync();
const options = {
authProvider,
};
const client = Client.init(options);
await client.api('/me/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7')
.version('beta')
.delete();
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/authentication/phoneMethods/3179e48a-750b-4051-897c-87b9720928f7"]]];
[urlRequest setHTTPMethod:@"DELETE"];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
graphClient.me().authentication().phoneMethods("3179e48a-750b-4051-897c-87b9720928f7")
.buildRequest()
.delete();
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
phoneAuthenticationMethodId := "phoneAuthenticationMethod-id"
graphClient.Me().Authentication().PhoneMethodsById(&phoneAuthenticationMethodId).Delete()
Import-Module Microsoft.Graph.Identity.SignIns
# A UPN can also be used as -UserId.
Remove-MgUserAuthenticationPhoneMethod -UserId $userId -PhoneAuthenticationMethodId $phoneAuthenticationMethodId
响应
下面展示了示例响应。
HTTP/1.1 204 No Content