经确认,目前Sign-ins功能在中国区还没有开通。也没有相关的预计开通时间。您可以通过如下链接随时关注China Azure的最新公告:https://www.azure.cn/zh-cn/what-is-new/

 

 

作为Workaround,可以通过Rest API的方式查看Sign-in记录,详情操作见下:

 

1.在AAD下创建应用程序,用于AAD密码授权

 

a.进入Azure Portal的AAD选项,创建应用程序

 

 

b.点击设置,授予所需权限

 

 

 

c.点击设置,配置密钥,并记录密钥,用于后续使用

备注:到期时间根据贵司环境自行设置

 

 

d.记录如下应用程序ID,用于后续使用

 

 

2.使用如下Powershell  Script生成Access Token

$username = "***@***.partner.onmschina.cn"; #Your Azure Account Name
$password = "*** ";  #Your Azure Account Password
$client_id = "***" #your AAD Application ID
$client_secret = "****" #Your AAD Application Key Value
$resource = "https://graph.chinacloudapi.cn/" 
$creds = @{
    grant_type = "password"
    username = $username
    password = $password        
    client_id = $client_id
    client_secret = $client_secret
    resource = $resource

};

$headers = $null

try
{
    $response = Invoke-RestMethod "https://login.chinacloudapi.cn/common/oauth2/token" -Method Post -Body $creds -Headers $headers;
    $token = $response.access_token;
    return $token;
}
catch
{
    $result = $_.Exception.Response.GetResponseStream();
    $reader = New-Object System.IO.StreamReader($result);
    $reader.BaseStream.Position = 0;
    $reader.DiscardBufferedData();
    $responseBody = $reader.ReadToEnd() | ConvertFrom-Json
    Write-Host "ERROR: $($responseBody.error_description)"
    return;
}

 

脚本会生成以“eyJ0eX”开头的字符串,需要将其拷贝到text文本编辑器去除空格或换行,使其成为一串完整的字符串,并在其前面加上“Bearer ”关键字,编辑完成后的token如下:

 

 

 

3.使用Postman工具作为API Client Tool进行请求

 

a.下载,安装注册Postman工具

备注:下载地址,https://www.getpostman.com/apps

 

 

b.使用类似如下格式的URL作为Get请求:

https://graph.chinacloudapi.cn/***.partner.onmschina.cn/activities/signinEvents?api-version=beta&$filter=userId+eq+'***'+and+signinDateTime+ge+2018-07-01T00:00:00Z+and+signinDateTime+le+2018-07-17T23:59:59Z

备注:黄色部分需要自定义,如下为各部分的解释

Part1: Azure Account Name @后面的部分,称之为tenantname

Part2: Azure Account Name的Object ID,可通过如下位置获取

 

Part3:自定义的开始及结束日期,时区为UTC

 

c.通过Postman,查看Sign-In记录

 

posted on 2018-07-17 15:37  铭的随记  阅读(668)  评论(0编辑  收藏  举报