Skip to content

Commit

Permalink
Merge pull request #777 from chkoide/chkoide-patch-1-0731
Browse files Browse the repository at this point in the history
Chkoide patch 1 0731
  • Loading branch information
chkoide authored Jun 11, 2024
2 parents 7244e30 + c768ce0 commit d076ce5
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
47 changes: 30 additions & 17 deletions articles/azure-active-directory/azuread-module-retirement4.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,21 @@ Get-MgUser -Filter "accountEnabled eq true and usertype eq 'Guest'"
ExtensionAttribute1 などの属性は、ユーザーの onpremisesExtensionAttributes の配下に用意されているので、下記のように実行して取得します。

```
(get-mguser -UserId 4e6bc6e4-d6e7-4bd8-9079-3393e12dcec3).onpremisesExtensionAttributes | fl
(Get-MgBetaUser -UserId 3796e4df-bf11-4b99-9be7-c65c63dfe9a6).OnpremisesExtensionAttributes | fl
```

![](./azuread-module-retirement4/azuread-module-retirement4-9.png)
![](./azuread-module-retirement4/azuread-module-retirement4-11-2.png)

こちらは beta のみ対応しておりますので、Connect-MgGraph での接続後、本コマンド実行前に Select-Mgprofile -name beta にてベータに切り替えを実施ください。


> [!NOTE]
>
> Microsoft Graph Powershell v2.x では、 Select-MgProfile コマンドでのベータ版切り替えがなくなりました。
> v2 をご利用いただく場合、Select-MgProfile -name beta コマンドの切り替えではなく、 beta 用のコマンド Get-Mgbetauser をご利用ください。
>
> Microsoft Graph Powershell v2.x の詳細は [こちら](https://jpazureid.github.io/blog/azure-active-directory/microsoft-graph-powershell-v2.0/) をご覧ください。
>
> v1.x を利用されている場合、Connect-MgGraph での接続後、本コマンド実行前に Select-Mgprofile -name beta にてベータに切り替えを実施し、 Get-MgUser コマンドをご利用ください。
<h3 id="idx1-6">削除済みユーザーを取得したい</h3>

Expand Down Expand Up @@ -210,31 +219,35 @@ Update-Mguser コマンドを利用して更新が可能です。たとえばユ
時折ご質問をいただくものとして、extensionattribute 関連の属性を更新したいといったお問い合わせがよくあるため、以下に手順を例として案内します。 Extensionattribute の値を更新したい場合、事前に beta に切り替えてからコマンドを実行ください。

1. Connect-MgGraph にて接続します。
2. beta バージョンへ切り替えます。

```
Select-MgProfile -Name "beta"
```

3. Get-Mguser コマンドを実行して、ユーザーの情報を取得します。
2. Get-MgBetaUser コマンドを実行して、ユーザーの情報を取得します。

```
(Get-MgUser -UserId 4e6bc6e4-d6e7-4bd8-9079-3393e12dcec3).onpremisesExtensionAttributes | fl
(Get-MgBetaUser -UserId 3796e4df-bf11-4b99-9be7-c65c63dfe9a6).OnpremisesExtensionAttributes | fl
```

以下の画面では、ユーザーの ExtensionAttribute1 の値に test という文字列が入っていることが確認できます。
以下の画面では、ユーザーの ExtensionAttribute4 の値に test4 という文字列が入っていることが確認できます。

![](./azuread-module-retirement4/azuread-module-retirement4-11.png)
![](./azuread-module-retirement4/azuread-module-retirement4-11-2.png)

4. 以下のコマンドを実行して、たとえば ExtensionAttribute1 の値を test2 に更新します。
3. 以下のコマンドを実行して、たとえば ExtensionAttribute4 の値を test44 に更新します。

```
Update-MgUser -UserId 4e6bc6e4-d6e7-4bd8-9079-3393e12dcec3 -OnPremisesExtensionAttributes @{"ExtensionAttribute1"='test2'}
Update-MgBetaUser -UserId 3796e4df-bf11-4b99-9be7-c65c63dfe9a6 -OnPremisesExtensionAttributes @{"ExtensionAttribute4"='test44'}
```

5. 値が test2 に更新されたことを確認します。
4. 値が test44 に更新されたことを確認します。

![](./azuread-module-retirement4/azuread-module-retirement4-12-2.png)


> [!NOTE]
>
> Microsoft Graph Powershell v2.x では、 Select-MgProfile コマンドでのベータ版切り替えがなくなりました。
> 変更に伴い手順を変更しておりますが、もしまだ v1.x を利用されている場合は、接続後に Select-MgProfile -Name "beta" で切り替えを実施してください。
>
> 利用しているバージョンが分からない場合は、 Get-InstalledModule Microsoft.Graph* を実行し、バージョンを確認してください。

![](./azuread-module-retirement4/azuread-module-retirement4-12.png)

<h2 id="idx6">6. よくある質問</h3>

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 6 additions & 7 deletions articles/azure-active-directory/howto-deal-with-aadsts1002016.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Windows 7 / Windows Server 2008 R2 の場合は、OS として TLS 1.2 を利

1. Azure portal (https://portal.azure.com) に全体管理者でサインインし、 [Azure Active Directory] を開きます。
2. [サインイン ログ] を選択します。
3. フィルタとして "許可された時刻:過去 24 時間" が既定で設定されていますので適宜 "過去 7 日間" などに変更します。
3. フィルターとして "許可された時刻:過去 24 時間" が既定で設定されていますので適宜 "過去 7 日間" などに変更します。
4. [ダウンロード] - "CSV のダウンロード" をクリックします。
5. InteractiveSignIns_20xx-xx-xx_20xx-xx-xx、NonInteractiveSignIns_20xx-xx-xx_20xx-xx-xx、ApplicationSignIns_20xx-xx-xx_20xx-xx-xx、MSISignIns_20xx-xx-xx_20xx-xx-xx の 4 つをそれぞれダウンロードします。
6. ダウンロードした CSV ファイルを開き、"サインインのエラー コード" として 1002016 が含まれていないか確認します。
Expand All @@ -133,19 +133,18 @@ Azure AD Premium をテナントで利用されていることが前提ですが

2. 次のコマンドを実行して、Microsoft Graph SDK をインストールし、実行ポリシーを設定します。
```
Install-Module Microsoft.Graph -Scope AllUsers
Install-Module Microsoft.Graph.Beta -Scope AllUsers
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser
```

3. 次のスクリプトを PowerShell スクリプト (.ps1) ファイルに保存します。最初の 3 行は、取得対象テナントのテナント ID、何日分のログを取得するかの日数 (例では 7 日になっています)、出力先のフォルダ名 (例では c:\temp\) を環境に合わせて編集します。
3. 次のスクリプトを PowerShell スクリプト (.ps1) ファイルに保存します。最初の 3 行は、取得対象テナントのテナント ID、何日分のログを取得するかの日数 (例では 7 日になっています)、出力先のフォルダー名 (例では c:\temp\) を環境に合わせて編集します。
```
$tId = "テナント ID" # テナント ID を入れてください。テナント ID は Azure ポータルの Azure Active Directory の概要から取得できます。
$agoDays = 7 # 何日前からのログを取得するか日数を指定します。
$pathForExport = "c:\temp\" # CSV ファイルの出力先フォルダ名を入力します。
$startDate = (Get-Date).AddDays(-($agoDays)).ToString('yyyy-MM-dd') # $agoDays で指定した日数を元に取得対象の開始日を得ます
Connect-MgGraph -Scopes "AuditLog.Read.All" -TenantId $tId
Select-MgProfile "beta" # ベータのエンドポイントへの接続が必要です
# フィルタ条件を定義しています。サインイン ログに TLS 1.0 / 1.1 が利用されたことを示すエントリのみをフィルタするようにしています
$procDetailFunction = "x: x/key eq 'legacy tls (tls 1.0, 1.1, 3des)' and x/value eq '1'"
Expand All @@ -157,9 +156,9 @@ $clauses = (
)
# フィルタ条件に従って対話型、非対話型、 ServicePrincipal のそれぞれのログを取得します。
$signInsInteractive = Get-MgAuditLogSignIn -Filter ($clauses[0,3] -Join " and ") -All
$signInsNonInteractive = Get-MgAuditLogSignIn -Filter ($clauses[0,1,3] -Join " and ") -All
$signInsWorkloadIdentities = Get-MgAuditLogSignIn -Filter ($clauses[0,2,3] -Join " and ") -All
$signInsInteractive = Get-MgBetaAuditLogSignIn -Filter ($clauses[0,3] -Join " and ") -All
$signInsNonInteractive = Get-MgBetaAuditLogSignIn -Filter ($clauses[0,1,3] -Join " and ") -All
$signInsWorkloadIdentities = Get-MgBetaAuditLogSignIn -Filter ($clauses[0,2,3] -Join " and ") -All
$columnList = @{ # 対話型、非対話型の出力ファイルに含むカラムを定義しています
Property = "CorrelationId", "createdDateTime", "userPrincipalName", "userId",
Expand Down

0 comments on commit d076ce5

Please sign in to comment.