# \`Repository packages-microsoft-com-prod is listed more than once in the configuration\`のメッセージの解消方法

## `Repository packages-microsoft-com-prod is listed more than once in the configuration`のメッセージの解消方法

Amazon Linux AMI(※今現在はAmazon Linux 2の利用が推奨されています)に対して、パッチの一括処理(Patch ManagerでAWS-RunPatchBaselineのタスクを実行しているときに確認した事象)をしているときに、一台のインスタンスが以下のメッセージが表示されて、パッチを適用に失敗していました。

```
Repository packages-microsoft-com-prod is listed more than once in the configuration
```

たしかに、表示されたレポジトリが2つの設定に含まれていました。

```
# cd /etc/yum.repos.d/
# grep -r "packages-microsoft-com-prod" ./
./msprod.repo:[packages-microsoft-com-prod]
./msprod.repo:name=packages-microsoft-com-prod
./mssql-release.repo:[packages-microsoft-com-prod]
./mssql-release.repo:name=packages-microsoft-com-prod
```

それぞれの設定ファイルを確認したところ、誤ってRHEL6用のものを入れるべきところをRHEL7用のものもインストールしてしまっていたことが原因でした。

```
# cat msprod.repo 
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/7/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
# cat mssql-release.repo 
[packages-microsoft-com-prod]
name=packages-microsoft-com-prod
baseurl=https://packages.microsoft.com/rhel/6/prod/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc
```

そのため、不要なRHEL7側のレポジトリの設定ファイルを削除して対応が完了しました。

```
# rm msprod.repo 
```

* References
  * [Repository packages-microsoft-com-prod is listed more than once in the configuration](https://stackoverflow.com/questions/56148712/repository-packages-microsoft-com-prod-is-listed-more-than-once-in-the-configura)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hayashier.gitbook.io/article/aws/alami-listed-more-than-once-error.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
