次の方法で共有


顧客のユーザー パスワードをリセットする

パスワードのリセットは、顧客の既存のユーザー アカウントの他の詳細を更新するのと似ています。

前提条件

  • パートナー センターの認証に関するページで説明している資格情報。 このシナリオでは、アプリとユーザーの資格情報を使用した認証のみがサポートされます。

  • 顧客 ID です (customer-tenant-id)。 顧客の ID がわからない場合は、パートナー センター検索できます。 パートナー センターの ホーム ページから [顧客 ] ワークスペースを選択します。 顧客の一覧から顧客を選択し、[アカウント] を選択します。 顧客の [アカウント] ページで、[顧客アカウントの詳細] セクションで Microsoft ID を探します。 Microsoft ID は、顧客 ID (customer-tenant-id) と同じです。

GDAP ロール

次の GDAP ロールのうち少なくとも 1 つが必要です。

  • ユーザー管理者
  • 特権認証管理者

C#

指定した顧客ユーザーのパスワードをリセットするには、まず、指定した顧客 ID と対象ユーザーを取得します。 次に、既存の顧客の情報を含む新しい CustomerUser オブジェクトを作成しますが、新しい PasswordProfile オブジェクトを使用します。 次に、IAggregatePartner.Customers コレクションを使用し、ById() メソッドを呼び出します。 次に、Users プロパティ、ById() メソッド、Patch メソッドを呼び出します。

// IAggregatePartner partnerOperations;
// string selectedCustomerId;
// CustomerUser specifiedUser;

var selectedCustomer = partnerOperations.Customers.ById(selectedCustomerId).Get();
var userToUpdate = new CustomerUser()
   {
      PasswordProfile = new PasswordProfile() { ForceChangePassword = true, Password = "newPassword" },
      DisplayName = "Roger Federer",
      FirstName = "Roger",
      LastName = "Federer",
      UsageLocation = "US",
      UserPrincipalName = Guid.NewGuid().ToString("N") + "@" + selectedCustomer.CompanyProfile.Domain.ToString()
   };

// update customer user information
User updatedCustomerUserInfo = partnerOperations.Customers.ById(selectedCustomerId).Users.ById(specifiedUser.Id).Patch(userToUpdate);

コンソール テスト アプリプロジェクト: PartnerSDK.FeatureSamples クラス: CustomerUserUpdate.cs

REST 要求

要求の構文

認証方法 要求 URI
PATCH {baseURL}/v1/customers/{customer-tenant-id}/users/{user-id}/resetpassword HTTP/1.1

URI パラメーター

正しい顧客を識別するには、次のクエリ パラメーターを使用します。

名前 種類 必須 説明
customer-tenant-id guid Y この値は、リセラーがリセラーに 属する特定の顧客の結果をフィルター処理できるようにする、GUID 形式の customer-tenant-id です。
user-id guid Y 値は、1 つのユーザー アカウントに 属する GUID 形式のユーザー ID です。

要求ヘッダー

詳細については、「パートナー センター REST ヘッダー」を参照してください。

要求の例

PATCH https://api.partnercenter.microsoft.com/v1/customers/<customer-tenant-id>/users/<user-id>/resetpassword HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
MS-RequestId: b1317092-f087-471e-a637-f66523b2b94c
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
{
     "passwordProfile":{
        password: "Renew456*",
        forceChangePassword: true
      },

      "attributes": {
        "objectType": "CustomerUser"
      }
}

REST 応答

成功した場合、このメソッドは更新されたパスワード情報と共にユーザー情報を返します。

応答の成功とエラーのコード

各応答には、成功または失敗を示す HTTP ステータス コードと、追加のデバッグ情報が付属しています。 このコード、エラーの種類、追加のパラメーターを読み取るには、ネットワーク トレース ツールを使用します。 完全な一覧については、エラー コードに関するページを参照してください。

応答の例

HTTP/1.1 200 OK
Content-Length: 31942
Content-Type: application/json
MS-CorrelationId: aaaa0000-bb11-2222-33cc-444444dddddd
MS-RequestId: b1317092-f087-471e-a637-f66523b2b94c
Date: June 24 2016 22:00:25 PST
{
  "usageLocation": "AX",
  "id": "95794928-9abe-4548-8b43-50ffc20b9404",
  "userPrincipalName": "aaaa4@abcdefgh1234.onmicrosoft.com",
  "firstName": "aaaa4",
  "lastName": "aaaa4",
  "displayName": "aaaa4",
  "passwordProfile": {
    "forceChangePassword": false,
    "password": "Renew456*"
  },
  "lastDirectorySyncTime": null,
  "userDomainType": "none",
  "state": "active",
  "softDeletionTime": null,
  "links": {
    "self": {
      "uri": "/customers/eebd1b55-5360-4438-a11d-5c06918c3014/users/95794928-9abe-4548-8b43-50ffc20b9404",
      "method": "GET",
      "headers": [

      ]
    }
  },
  "attributes": {
    "objectType": "CustomerUser"
  }
}