如何通过ProxyAddresses在Azure B2C中查找重复用户?
查找Azure B2C中占用指定ProxyAddresses的对象
方法1:使用Microsoft Graph PowerShell模块
- 安装并连接模块(需管理员权限):
Install-Module Microsoft.Graph.Users -Force Connect-MgGraph -Scopes User.Read.All - 替换
your-proxy-address为目标地址,执行查询:
提示:如果是主邮箱地址(大写SMTP前缀),把Get-MgUser -Filter "proxyAddresses/any(x:x eq 'smtp:your-proxy-address')" -Select Id, DisplayName, UserPrincipalName, ProxyAddressessmtp:替换为SMTP:
方法2:查找非用户对象(组/服务主体)
如果上述查询无结果,该ProxyAddresses可能属于组或服务主体,执行以下命令:
- 查询组:
Get-MgGroup -Filter "proxyAddresses/any(x:x eq 'smtp:your-proxy-address')" -Select Id, DisplayName, ProxyAddresses - 查询服务主体:
Get-MgServicePrincipal -Filter "proxyAddresses/any(x:x eq 'smtp:your-proxy-address')" -Select Id, DisplayName, ProxyAddresses
方法3:使用Microsoft Graph API直接调用
发送GET请求(需携带User.Read.All权限的访问令牌):
- 查询用户:
https://graph.microsoft.com/v1.0/users?$filter=proxyAddresses/any(x:x eq 'smtp:your-proxy-address')&$select=id,displayName,userPrincipalName,proxyAddresses - 查询组:
https://graph.microsoft.com/v1.0/groups?$filter=proxyAddresses/any(x:x eq 'smtp:your-proxy-address')&$select=id,displayName,proxyAddresses - 查询服务主体:
https://graph.microsoft.com/v1.0/servicePrincipals?$filter=proxyAddresses/any(x:x eq 'smtp:your-proxy-address')&$select=id,displayName,proxyAddresses
内容的提问来源于stack exchange,提问作者Pedro
相关产品推荐
相关产品推荐

