> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/keeperpam-commands/pam-rotation-commands.md).

# PAM Rotationコマンド

レコードのKeeperローテーションの設定を表示および作成します。

### Rotation Listコマンド <a href="#rotation-list-command" id="rotation-list-command"></a>

ローテーションが設定されているすべてのリソースの一覧を表示します。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation list`

**別名**: `pam-rot list` / `pam-rot l`

**パラメーター**:

| パラメーター            | 説明                       |
| ----------------- | ------------------------ |
| `--verbose`, `-v` | ゲートウェイUIDとPAM構成UIDの列を含める |

例:

{% code expandable="true" %}

```csharp
My Vault> pam-rotation list
Syncing PAM data...
Record UID              Record Title                      Record Type  Schedule           Gateway      PAM Configuration (Type)                   
----------------------  --------------------------------  -----------  -----------------  -----------  -------------------------------------------
2fImoc1puL7wyhsynV0Mu8ydkRQ  NG1 - MySQL Rotation User         pamUser      [Manual Rotation]  NG1 Gateway  NG1 Configuration (pamNetworkConfiguration)
YYR3C5lzHG0ndheoZfUVJc8zw2A  NG1 - SSH Admin with Password     pamUser      [Manual Rotation]  NG1 Gateway  NG1 Configuration (pamNetworkConfiguration)
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
    public static async Task<PamProto.PAMRotationSchedulesResponse> GetRotationSchedulesAsync(IAuthentication auth)
    {
      if (auth == null)
      {
        throw new ArgumentNullException(nameof(auth));
      }

      var request = new PamProto.PAMGenericUidsRequest();
      return await auth.ExecuteRouter<PamProto.PAMRotationSchedulesResponse>(
        GetRotationSchedulesPath,
        request);
    }
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Get-KeeperPamRotationList`

**別名**: `pam-rotation-list` / `pam-rot-list`

**パラメーター**:

| パラメーター                 | 説明                       |
| ---------------------- | ------------------------ |
| `-VerboseOutput`, `-v` | ゲートウェイUIDとPAM構成UIDの列を含める |

例:

{% code expandable="true" %}

```powershell
PS > Get-KeeperPamRotationList                           
Syncing PAM data...

Record UID             Record Title                       Record Type Schedule          Gateway       PAM Configuration (Type)
----------             ------------                       ----------- --------          -------       ------------------------
ah2zcniqasGsnAAOhZJzV83zeQ Gate1 - MySQL Rotation User        pamUser     [Manual Rotation] Gate1 Gateway Gate1 Configuration (pamNetworkConfiguration)
eYxj7nsyufYf27jr19_sr1aKDQ Gate1 - SSH Admin with Password    pamUser     [Manual Rotation] Gate1 Gateway Gate1 Configuration (pamNetworkConfiguration)
pP0ivRkEARiuatg5jpNydPOGKA Gate1 - SSH Admin with Private Key pamUser     [Manual Rotation] Gate1 Gateway Gate1 Configuration (pamNetworkConfiguration)

```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Infoコマンド <a href="#rotation-info-command" id="rotation-info-command"></a>

特定のリソースに対するローテーション設定の情報を表示します。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation info`

**別名**: `pam-rot info` / `pam-rot i`

**パラメーター**:

| パラメーター                  | 説明                  |
| ----------------------- | ------------------- |
| `--record`, `-r`        | レコードのUID、名前、またはタイトル |
| `--record-uid`          | `--record` のUID別名   |
| `--format {table,json}` | 出力形式。デフォルト: `table` |

\* `--record` または `--record-uid` のいずれかが必須です。

**例**:

{% code expandable="true" %}

```csharp
My Vault> pam-rotation info --record 2fImoc1puL7nV0Mu8ydkRQ
Rotation Status: Ready to rotate (RrsOnline)
PAM Config UID: R1dgEDZZ00ez02vY2njudgnB7Qg
Node ID: 894448414289341228482
Gateway Name: NG1 Gateway
Gateway UID: ygE7xsutS0ndhau555eiqZEIGZ-33qfQ
Admin Resource Uid: 4orXZIfikFwnahuSFOnj-Q0PM4KMA
Password Complexity: PRpTItpnjdyehwywio-wjwuwnjj2_WUD6DLlriG4x1WT8J3woK_otiTgYx588ID3hEl21-70Ue1Z-1JC07-04b5WZKYZUkdisXy0qK5JvppAvgXtDqJBW5a_ab8wAm6N3CiAbi
Password Complexity Data: 20,4,4,4,4,!@#$%^?();',.=+[]<>{}-_/\*&:"`~|
Is Rotation Disabled: True
Schedule: Manual Rotation
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
    public static async Task<RouterProto.RouterRotationInfo> GetRotationInfoAsync(
      IAuthentication auth,
      string recordUid)
    {
      if (auth == null)
      {
        throw new ArgumentNullException(nameof(auth));
      }

      if (string.IsNullOrWhiteSpace(recordUid))
      {
        throw new ArgumentException("Record UID is required", nameof(recordUid));
      }

      var request = new PamProto.PAMGenericUidRequest
      {
        Uid = ByteString.CopyFrom(recordUid.Trim().Base64UrlDecode()),
      };

      var response = await auth.ExecuteAuthRest(
        GetRotationInfoEndpoint,
        request,
        typeof(RouterProto.RouterRotationInfo));

      if (response is not RouterProto.RouterRotationInfo rotationInfo)
      {
        throw new InvalidOperationException(
          $"Unexpected response type from {GetRotationInfoEndpoint}: {response?.GetType().Name ?? "null"}");
      }

      return rotationInfo;
    }
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Get-KeeperPamRotationInfo`

**別名**: `pam-rotation-info` / `pam-rot-info`

**パラメーター**:

| パラメーター                     | 説明                  |
| -------------------------- | ------------------- |
| `-Record`, `-r`            | レコードのUID、名前、またはタイトル |
| `-RecordUid`               | `-Record` のUID別名    |
| `-Format {table,csv,json}` | 出力形式。デフォルト: `table` |

\* `-Record` または `-RecordUid` のいずれかが必須です。

**例**:

{% code expandable="true" %}

```powershell
PS > Get-KeeperPamRotationInfo -Record qzG2zuiq23cGsnAAOhZJzV83zeQ
Rotation Status: Ready to rotate (RrsOnline)
PAM Config UID: r0GEhsnhyaXL8fQaY3f_cyy_--w
Node ID: 8944484109127814228482
Gateway Name: Gate1 Gateway
Gateway UID: UorQhjoelaoauTNGA4rRzcNd-fQ
Admin Resource Uid: r0GEhsnhyaXL8fQaY3f_cyy_jaahy
Password Complexity: IQwBdlnCE9vj9nshsui6Fk3Gt45AUdXBMP4OM1ple1_p2pEhgyjsnjsuL8tt8QiLqDv7GUAmAZ-AX5KJGyWDwRE3EdDkuc3BrwAUjnUl-oCxFiMOnbWnTUO5qJEAlJS
Password Complexity Data: Length: 20; Lowercase: 4; Uppercase: 4; Digits: 4; Symbols: 4; Special Characters: !@#$%^?();',.=+[]<>{}-_/\*&:"`~|
Is Rotation Disabled: False
Schedule: Manual Rotation
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Editコマンド <a href="#rotation-edit-command" id="rotation-edit-command"></a>

PAMレコードのローテーション設定を作成または更新します。単一レコードの場合は `--record` を、一括設定の場合は `--folder` を使用します。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation edit`

**別名**: `pam-rot edit` / `pam-rot e` / `pam-rotation new` / `pam-rot new`

**パラメーター**:

<table data-search="false"><thead><tr><th width="288">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>--record</code>, <code>-r</code></td><td>レコードのUID、名前、またはパターン</td></tr><tr><td><code>--folder</code></td><td>一括ローテーション設定用のフォルダUIDまたは名前</td></tr><tr><td><code>--force</code>, <code>-f</code></td><td>確認プロンプトをスキップ</td></tr><tr><td><code>--config</code>, <code>-c</code></td><td>PAM構成のUIDまたはタイトル</td></tr><tr><td><code>--iam-aad-config</code></td><td>IAM/Azure AD用PAM構成のUID (<code>--resource</code>の代わりに指定)</td></tr><tr><td><code>--resource</code></td><td>管理者リソースレコードのUIDまたはタイトル</td></tr><tr><td><code>--rotation-profile</code></td><td>ローテーションプロファイル: <code>general</code>、<code>iam_user</code>、<code>scripts_only</code>、<code>saas</code></td></tr><tr><td><code>--saas-config-uid</code></td><td>SaaS構成のUID (<code>saas</code>プロファイル用)</td></tr><tr><td><code>--schedule-json</code></td><td>ローテーションスケジュールのJSON</td></tr><tr><td><code>--schedule-cron</code></td><td>ローテーションスケジュールのCRON式</td></tr><tr><td><code>--on-demand</code></td><td>手動 (オンデマンド) ローテーションを設定</td></tr><tr><td><code>--schedule-config</code></td><td>PAM構成からスケジュールを継承</td></tr><tr><td><code>--schedule-only</code></td><td>ローテーションスケジュールのみ更新</td></tr><tr><td><code>--complexity</code>, <code>-x</code></td><td>パスワード複雑度のCSV: <code>length,upper,lower,digits,symbols[,chars]</code></td></tr><tr><td><code>--complexity-json</code></td><td>パスワード複雑度ルール (JSON形式)</td></tr><tr><td><code>--admin-user</code>, <code>-a</code></td><td>リソースの管理者認証情報として設定するPAMユーザーレコードのUID</td></tr><tr><td><code>--enable</code>, <code>-e</code></td><td>ローテーションを有効化</td></tr><tr><td><code>--disable</code>, <code>-d</code></td><td>ローテーションを無効化</td></tr></tbody></table>

\* `--record` または `--folder` のいずれか一方が必須です (両方の指定は不可)。

\* `--resource` と `--iam-aad-config`、または `--enable` と `--disable` は同時に指定できません。

**例**:

{% code expandable="true" %}

```csharp
My Vault> pam-rotation edit -r "<record-uid>" -c "<configuration-uid>" --resource "<resource-uid>" --on-demand
Syncing PAM data...
Selected 1 PAM record(s) for rotation

The following record(s) will be updated:
Record UID              Record Title                 Enabled  Configuration UID       Resource UID            Schedule   Complexity                                 
----------------------  ---------------------------  -------  ----------------------  ----------------------  ---------  -------------------------------------------
cGsnAAsbsgayOhZJzV83zeQ  Gate1 - MySQL Rotation User  X        8i8quwtfQaY3f_cyy_--w  TmBY8772ataddJ7BgO978nw  On-Demand  20,4,4,4,4,!@#$%^?();',.=+[]<>{}-_/\*&:"`~|


Do you want to update password rotation? [Y/n]: y
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
    public static async Task SetRecordRotationAsync(IAuthentication auth, RouterProto.RouterRecordRotationRequest request)
    {
      if (auth == null)
      {
        throw new ArgumentNullException(nameof(auth));
      }

      if (request == null)
      {
        throw new ArgumentNullException(nameof(request));
      }

      if (auth.Endpoint is not KeeperEndpoint keeperEndpoint)
      {
        throw new InvalidOperationException("Endpoint must be KeeperEndpoint to use SetRecordRotationAsync");
      }

      await keeperEndpoint.ExecuteRouterRest(
        SetRecordRotationPath,
        auth.AuthContext.SessionToken,
        request.ToByteArray());
    }
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Set-KeeperPamRotation`

**別名**: `pam-rotation-edit` / `pam-rot-edit` / `pam-rotation-new` / `pam-rot-new`

**パラメーター**:

<table data-search="false"><thead><tr><th>パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>-Record</code>, <code>-r</code></td><td>レコードのUID、名前、またはパターン</td></tr><tr><td><code>-Folder</code>, <code>-fd</code></td><td>一括ローテーション設定用のフォルダUIDまたは名前</td></tr><tr><td><code>-Force</code>, <code>-f</code></td><td>確認プロンプトをスキップ</td></tr><tr><td><code>-Config</code>, <code>-c</code></td><td>PAM構成のUIDまたはタイトル</td></tr><tr><td><code>-IamAadConfig</code>, <code>-iac</code></td><td>IAM/Azure AD用PAM構成のUID</td></tr><tr><td><code>-Resource</code>, <code>-rs</code></td><td>管理者リソースレコードのUIDまたはタイトル</td></tr><tr><td><code>-RotationProfile</code>, <code>-rp</code></td><td><code>general</code>、<code>iam_user</code>、<code>scripts_only</code>、<code>saas</code></td></tr><tr><td><code>-SaasConfigUid</code></td><td>SaaS構成のUID (<code>saas</code>プロファイル用)</td></tr><tr><td><code>-ScheduleJson</code>, <code>-sj</code></td><td>ローテーションスケジュールのJSON</td></tr><tr><td><code>-ScheduleCron</code>, <code>-sc</code></td><td>ローテーションスケジュールのCRON式</td></tr><tr><td><code>-OnDemand</code>, <code>-od</code></td><td>手動オンデマンドローテーションを設定</td></tr><tr><td><code>-ScheduleConfig</code>, <code>-sf</code></td><td>PAM構成からスケジュールを継承</td></tr><tr><td><code>-ScheduleOnly</code>, <code>-so</code></td><td>ローテーションスケジュールのみ更新</td></tr><tr><td><code>-Complexity</code>, <code>-x</code></td><td>パスワード複雑度のCSV</td></tr><tr><td><code>-ComplexityJson</code></td><td>パスワード複雑度ルール (JSON形式)</td></tr><tr><td><code>-AdminUser</code>, <code>-a</code></td><td>管理者認証情報用のPAMユーザーレコードUID</td></tr><tr><td><code>-Enable</code>, <code>-e</code></td><td>ローテーションを有効化</td></tr><tr><td><code>-Disable</code>, <code>-d</code></td><td>ローテーションを無効化</td></tr></tbody></table>

\* `-Record` または `-Folder` のいずれか一方が必須です (両方の指定は不可)。

**例**:

{% code expandable="true" %}

```powershell
PS >  Set-KeeperPamRotation -Record "My PAM User" -Config "AWS Config" -Resource "My Server" -OnDemand
Selected 1 PAM record(s) for rotation

The following record(s) will be updated:
Record UID              Record Title                 Enabled  Configuration UID       Resource UID            Schedule   Complexity                                 
----------------------  ---------------------------  -------  ----------------------  ----------------------  ---------  -------------------------------------------
cGsnAAsbsgayOhZJzV83zeQ  Gate1 - MySQL Rotation User  X        8i8quwtfQaY3f_cyy_--w  TmBY8772ataddJ7BgO978nw  On-Demand  20,4,4,4,4,!@#$%^?();',.=+[]<>{}-_/\*&:"`~|


Do you want to update password rotation? [Y/n]: y

PS >
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Script listコマンド <a href="#rotation-script-list-command" id="rotation-script-list-command"></a>

PAMレコードに紐づくローテーション後スクリプトの一覧を表示するコマンドです。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation script list`

**別名**: `pam-rot script list` / `pam-rot script l`

**パラメーター**:

<table><thead><tr><th width="248">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>--pattern</code></td><td>レコードのUIDまたはタイトルによる絞り込み</td></tr><tr><td><code>--record</code>, <code>-r</code></td><td><code>--pattern</code> と同じ (レコードによる絞り込み)</td></tr><tr><td><code>&#x3C;filter></code> (位置引数)</td><td>レコードのUID/タイトルによる絞り込み</td></tr></tbody></table>

**例**:

{% code expandable="true" %}

```csharp
My Vault> pam-rotation script list                                                                                                                                                        
Record UID              Title                     Record Type  Script UID              Script Name  Records  Command                    
----------------------  ------------------------  -----------  ----------------------  -----------  -------  ---------------------------
qdWnshsutT6khktOWSFJng  Gate1 - MySQL Admin User  pamUser      BK3wndhuSeSk1BUNwI7r_g  rotate.ps1            powershell -File rotate.ps1

```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
foreach (var keeperRecord in vault.KeeperRecords.OfType<TypedRecord>())
{
    var fields = keeperRecord.Fields
        .OfType<TypedField<FieldScript>>()
        .Where(f =>
            string.Equals(f.FieldName, "script", StringComparison.Ordinal)
            || string.Equals(f.FieldLabel, "rotationScripts", StringComparison.Ordinal));
    foreach (var field in fields)
    {
        foreach (var script in field.Values.Where(s => !string.IsNullOrEmpty(s?.FileRef)))
        {
            Console.WriteLine($"{keeperRecord.Uid} | {script.FileRef} | {script.Command}");
        }
    }
}
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Get-KeeperPamRotationScript`

**別名**: `pam-rotation-script-list` / `pam-rot-script-list`

**パラメーター**:

<table><thead><tr><th width="315">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>-Pattern</code></td><td>レコードのUIDまたはタイトルによる絞り込み</td></tr><tr><td><code>-Record</code>, <code>-r</code></td><td><code>-Pattern</code> と同じ</td></tr></tbody></table>

**例**:

{% code expandable="true" %}

```powershell
PS > Get-KeeperPamRotationScript
Record UID              Title                     Record Type  Script UID              Script Name  Records  Command                    
----------------------  ------------------------  -----------  ----------------------  -----------  -------  ---------------------------
qdWnshsutT6khktOWSFJng  Gate1 - MySQL Admin User  pamUser      BK3wndhuSeSk1BUNwI7r_g  rotate.ps1            powershell -File rotate.ps1
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Script addコマンド <a href="#rotation-script-add-command" id="rotation-script-add-command"></a>

ローカルのスクリプトファイルをアップロードし、ローテーション後スクリプトとして紐づけるコマンドです。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation script add`

**別名**: `pam-rot script add` / `pam-rot script new` / `pam-rot script a`

**パラメーター**:

<table><thead><tr><th width="322">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>--record</code>, <code>-r</code> / <code>&#x3C;record></code> (位置引数)</td><td>レコードのUIDまたはタイトル (<code>pamUser</code> / <code>pamDirectory</code>)</td></tr><tr><td><code>--script</code> / <code>&#x3C;script></code> (位置引数)</td><td>アップロードするローカルスクリプトファイルのパス</td></tr><tr><td><code>--run-command</code></td><td>ローテーション後にスクリプトを実行するコマンドライン</td></tr><tr><td><code>--script-command</code></td><td><code>--run-command</code> の別名 (値がサブコマンド名でない場合)</td></tr><tr><td><code>--add-credential</code></td><td>紐づけるローテーション認証情報のレコードUID (複数指定可)</td></tr></tbody></table>

**例:**

{% code expandable="true" %}

```csharp
My Vault> pam-rotation script add --record "<record-uid>" --script "C:\\Users\\AnanthReddyMandli\\Documents\\GitHub\\Temp\\rotate.ps1" --run-command "powershell -File rotate.ps1"
Script added to record 'Gate1 - MySQL Admin User' (kepo6sqdWT6khktOWSFJng).

```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
var record = (TypedRecord)vault.GetKeeperRecord(recordUid);
// Ensure script field exists
var scriptField = record.Fields
    .OfType<TypedField<FieldScript>>()
    .FirstOrDefault(f =>
        string.Equals(f.FieldName, "script", StringComparison.Ordinal)
        || string.Equals(f.FieldLabel, "rotationScripts", StringComparison.Ordinal));
if (scriptField == null)
{
    scriptField = new TypedField<FieldScript>("script", "rotationScripts");
    record.Fields.Add(scriptField);
}
var facade = new TypedRecordFacade<TypedRecordFileRef>(record);
var preRefs = new HashSet<string>(
    facade.Fields.FileRef?.Values ?? Enumerable.Empty<string>(),
    StringComparer.Ordinal);
using (var uploadTask = new FileAttachmentUploadTask(filePath, isScript: true))
{
    await vault.UploadAttachment(record, uploadTask);
}
var postRefs = new HashSet<string>(
    facade.Fields.FileRef?.Values ?? Enumerable.Empty<string>(),
    StringComparer.Ordinal);
var newUids = postRefs.Except(preRefs).ToList();
if (newUids.Count != 1)
{
    throw new InvalidOperationException(
        "Failed to determine uploaded script file UID. Only the record owner can attach post-rotation scripts.");
}
// Move file out of generic fileRef into script field
facade.Fields.FileRef?.Values.Remove(newUids[0]);
scriptField.Values.Add(new FieldScript
{
    FileRef = newUids[0],
    Command = "powershell -File rotate.ps1",
    RecordRef = new[] { credentialUid },
});
await vault.UpdateRecord(record);

```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Add-KeeperPamRotationScript`

**別名**: `pam-rotation-script-add` / `pam-rot-script-add`

**パラメーター**:

<table><thead><tr><th width="278">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>-Record</code>, <code>-r</code> / 位置引数</td><td>レコードのUIDまたはタイトル</td></tr><tr><td><code>-RecordUid</code></td><td>レコードUIDの別名</td></tr><tr><td><code>-Script</code> / 位置引数</td><td>ローカルスクリプトファイルのパス</td></tr><tr><td><code>-RunCommand</code></td><td>ローテーション後に実行するコマンドライン</td></tr><tr><td><code>-ScriptCommand</code></td><td><code>-RunCommand</code> の別名</td></tr><tr><td><code>-AddCredential</code>, <code>-ac</code></td><td>紐づける認証情報レコードのUID (複数指定可)</td></tr></tbody></table>

**例**:

{% code expandable="true" %}

```powershell
PS > Add-KeeperPamRotationScript -Record <UID> -Script "C:\scripts\rotate.ps1" -RunCommand "powershell -File rotate.ps1"
Script added to record 'Gate1 - MySQL Admin User' (kepo6sqdWT6khktOWSFJng).
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Script editコマンド <a href="#rotation-script-edit-command" id="rotation-script-edit-command"></a>

PAMレコードに設定済みのローテーション後スクリプトを更新するコマンドです。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation script edit`

**別名**: `pam-rot script edit` / `pam-rot script e`

**パラメーター**:

| パラメーター                               | 説明                           |
| ------------------------------------ | ---------------------------- |
| `--record`, `-r` / `<record>` (位置引数) | レコードのUIDまたはタイトル              |
| `--script` / `<script>` (位置引数)       | 更新するスクリプトファイルのUIDまたは名前       |
| `--run-command`                      | スクリプトを実行する新しいコマンドライン         |
| `--script-command`                   | `--run-command` の別名          |
| `--add-credential`                   | 紐づける認証情報レコードのUID (複数指定可)     |
| `--remove-credential`                | 紐づけを解除する認証情報レコードのUID (複数指定可) |

例:

{% code overflow="wrap" %}

```csharp
My Vault> pam-rotation script edit --record kepo6smju76qdWT6khktOWSFJng --script rotate.ps1 --run-command "powershell -File rotate.ps1"
Script updated on record 'Gate1 - MySQL Admin User' (kepo6smju76qdWT6khktOWSFJng ).
Command: powershell -File rotate.ps1
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
var record = (TypedRecord)vault.GetKeeperRecord(recordUid);
var scriptField = record.Fields
    .OfType<TypedField<FieldScript>>()
    .FirstOrDefault(f =>
        string.Equals(f.FieldName, "script", StringComparison.Ordinal)
        || string.Equals(f.FieldLabel, "rotationScripts", StringComparison.Ordinal));

FieldScript scriptValue = null;
foreach (var script in scriptField.Values)
{
    if (string.Equals(script.FileRef, scriptUidOrName, StringComparison.OrdinalIgnoreCase))
    {
        scriptValue = script;
        break;
    }

    if (vault.TryGetKeeperRecord(script.FileRef, out var fileKeeper)
        && fileKeeper is FileRecord fileRecord
        && (string.Equals(fileRecord.Title, scriptUidOrName, StringComparison.OrdinalIgnoreCase)
            || string.Equals(fileRecord.Name, scriptUidOrName, StringComparison.OrdinalIgnoreCase)))
    {
        scriptValue = script;
        break;
    }
}

var refs = new HashSet<string>(scriptValue.RecordRef ?? Array.Empty<string>(), StringComparer.Ordinal);
refs.Remove(credentialUidToRemove);
refs.Add(credentialUidToAdd);
scriptValue.RecordRef = refs.ToArray();
scriptValue.Command = "powershell -File rotate_v2.ps1";

await vault.UpdateRecord(record);
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Set-KeeperPamRotationScript`

**別名**: `pam-rotation-script-edit` / `pam-rot-script-edit`

**パラメーター**:

<table data-search="false"><thead><tr><th>パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>-Record</code>, <code>-r</code> / 位置引数</td><td>レコードのUIDまたはタイトル</td></tr><tr><td><code>-RecordUid</code></td><td>レコードUIDの別名</td></tr><tr><td><code>-Script</code> / 位置引数</td><td>スクリプトファイルのUIDまたは名前</td></tr><tr><td><code>-RunCommand</code></td><td>実行する新しいコマンドライン</td></tr><tr><td><code>-ScriptCommand</code></td><td><code>-RunCommand</code> の別名</td></tr><tr><td><code>-AddCredential</code>, <code>-ac</code></td><td>紐づける認証情報レコードのUID (複数指定可)</td></tr><tr><td><code>-RemoveCredential</code>, <code>-rc</code></td><td>紐づけを解除する認証情報レコードのUID (複数指定可)</td></tr></tbody></table>

**例**:

{% code expandable="true" %}

```powershell
PS > Set-KeeperPamRotationScript -Record <UID> -Script rotate.ps1 -RunCommand "powershell -File rotate.ps1"
Script updated on record 'Gate1 - MySQL Admin User' (kepo6smju76qdWT6khktOWSFJng ).
Command: powershell -File rotate.ps1
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>

### Rotation Script deleteコマンド <a href="#rotation-script-delete-command" id="rotation-script-delete-command"></a>

PAMレコードからローテーション後スクリプトを削除するコマンドです。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `pam-rotation script delete`

**別名**: `pam-rot script delete` / `pam-rot script d`

**パラメーター**:

| パラメーター                               | 説明                     |
| ------------------------------------ | ---------------------- |
| `--record`, `-r` / `<record>` (位置引数) | レコードのUIDまたはタイトル        |
| `--script` / `<script>` (位置引数)       | 削除するスクリプトファイルのUIDまたは名前 |

例:

{% code overflow="wrap" %}

```csharp
My Vault>  pam-rotation script delete --record kepo6sq145uydWT6khktOWSFJng --script rotate.ps1
Script removed from record 'Gate1 - MySQL Admin User' (kepo6sq145uydWT6khktOWSFJng ).
```

{% endcode %}

</details>

<details>

<summary>DotNet SDK</summary>

**関数:**

```csharp
var record = (TypedRecord)vault.GetKeeperRecord(recordUid);
var scriptField = record.Fields
    .OfType<TypedField<FieldScript>>()
    .FirstOrDefault(f =>
        string.Equals(f.FieldName, "script", StringComparison.Ordinal)
        || string.Equals(f.FieldLabel, "rotationScripts", StringComparison.Ordinal));

var scriptValue = scriptField.Values
    .FirstOrDefault(s => string.Equals(s.FileRef, scriptUid, StringComparison.OrdinalIgnoreCase));

scriptField.Values.Remove(scriptValue);
await vault.UpdateRecord(record);
```

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Remove-KeeperPamRotationScript`

**別名**: `pam-rotation-script-delete` / `pam-rot-script-delete`

**パラメーター**:

<table><thead><tr><th width="298">パラメーター</th><th>説明</th></tr></thead><tbody><tr><td><code>-Record</code>, <code>-r</code> / 位置引数</td><td>レコードのUIDまたはタイトル</td></tr><tr><td><code>-RecordUid</code></td><td>レコードUIDの別名</td></tr><tr><td><code>-Script</code> / 位置引数</td><td>スクリプトファイルのUIDまたは名前</td></tr></tbody></table>

**例**:

{% code expandable="true" %}

```powershell
PS >  Remove-KeeperPamRotationScript -Record <UID> -Script rotate.ps1
Script removed from record 'Gate1 - MySQL Admin User' (kepo6sq14snaha5uydWT6khktOWSFJng ).
```

{% endcode %}

</details>

<details>

<summary>Python CLI</summary>

**コマンド: 近日公開**

</details>

<details>

<summary>Python SDK</summary>

**コマンド: 近日公開**

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.keeper.io/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/keeperpam-commands/pam-rotation-commands.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
