{"id":732,"date":"2023-08-07T10:02:13","date_gmt":"2023-08-07T01:02:13","guid":{"rendered":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=732"},"modified":"2023-08-07T10:04:45","modified_gmt":"2023-08-07T01:04:45","slug":"microsoft-graph-powershell-module%e3%82%92%e4%bd%bf%e7%94%a8%e3%81%97%e3%81%9f%e3%83%a9%e3%82%a4%e3%82%bb%e3%83%b3%e3%82%b9%e4%bb%98%e4%b8%8e","status":"publish","type":"post","link":"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=732","title":{"rendered":"Microsoft Graph Powershell Module\u3092\u4f7f\u7528\u3057\u305f\u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e"},"content":{"rendered":"\n<p>MSOnline Powershell\u30e2\u30b8\u30e5\u30fc\u30eb\u306eSet-MsolUserLicense\u30b3\u30de\u30f3\u30c9\u30ec\u30c3\u30c8\u304c\u975e\u63a8\u5968\u306b\u306a\u3063\u305f\u3002<\/p>\n\n\n\n<p>\u4f7f\u7528\u3059\u308b\u3053\u3068\u306f\u672a\u3060\u53ef\u80fd\u3060\u304c\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306a\u3069\u3067\u9023\u7d9a\u51e6\u7406\u3092\u884c\u306a\u3046\u3068\u30013\uff5e4\u4ef6\u3050\u3089\u3044\u51e6\u7406\u3057\u305f\u5f8c\u306b\u3001\u4e0b\u8a18\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u3066\u3001\u6b21\u306e\u51e6\u7406\u3092\u884c\u3048\u308b\u307e\u3067\u306b\u304b\u306a\u308a\u306e\u6642\u9593(\u5206\u306e\u30aa\u30fc\u30c0\u30fc)\u304c\u639b\u304b\u308a\u5b9f\u7528\u7684\u3067\u306f\u306a\u3044\u3002<\/p>\n\n\n\n<p><strong>You have exceeded the maximum number of allowable transactions. Please try again later<\/strong><\/p>\n\n\n\n<p>\u4ed5\u65b9\u304c\u7121\u3044\u306e\u3067\u3001Microsoft Graph API\u3092\u4f7f\u7528\u3057\u305f\u65b9\u6cd5\u3092\u8a66\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<p>\u305f\u3060\u3001\u9762\u5012\u306a\u306e\u306f\u30e9\u30a4\u30bb\u30f3\u30b9\u3092\u8ffd\u52a0\u3059\u308b\u306b\u3057\u308d\u524a\u9664\u3059\u308b\u306b\u3057\u308d\u3001Microsoft Graph API\u3068\u540c\u3058\u5f62\u3067\u3001\u8ffd\u52a0\uff0c\u524a\u9664\u53cc\u65b9\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u9808\u306a\u3068\u3053\u308d\u3002<\/p>\n\n\n\n<p>\u4e00\u3005\u3001\u624b\u3067\u6253\u3061\u8fbc\u3080\u306e\u306f\u5927\u5909\u306a\u306e\u3067\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306afunction\u3092\u4f5c\u6210\u3057\u3066\u307f\u305f\u3002<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism undefined-numbers lang-powershell\" data-file=\"\u30e9\u30a4\u30bb\u30f3\u30b9\u8ffd\u52a0\u30fb\u524a\u9664\" data-lang=\"PowerShell\"><code># MS Graph\u3092\u4f7f\u7528\u3057\u3066\u30e9\u30a4\u30bb\u30f3\u30b9\u306e\u4ed8\u4e0e\n# skuname\u306fEXCHANGESTANDARD\u3084ENTERPRISEPACK\u7b49\nfunction global:AddLicense($user,$skuname) {\n\t# \u8ffd\u52a0\u3059\u308b\u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u30e9\u30a4\u30bb\u30f3\u30b9\u306eSkuId(GUID)\u3092\u53d6\u5f97\n\t$local:sku = get-mgsubscribedsku -all | where-object {$_.SkuPartNumber -eq $skuname}\n\t$lic = @(\n\t\t@{\n\t\t\tSkuId = $sku.SkuId\n\t\t\tDisabledPlans = @()\n\t\t}\n\t)\n\t# UserID\u3092\u53d6\u5f97\n\t$local:uid = get-mguser -userid $user\n\t# \u30e9\u30a4\u30bb\u30f3\u30b9\u4ed8\u4e0e(-RemoveLicenses\u30d1\u30e9\u30e1\u30fc\u30bf\u3082\u5fc5\u9808-\u7a7a\u306e\u30ea\u30b9\u30c8\u3092\u6e21\u3059)\n\tset-mguserlicense -userid $uid.Id -addlicenses $lic -removelicenses @()\n}\n# MS Graph\u3092\u4f7f\u7528\u3057\u3066\u30e9\u30a4\u30bb\u30f3\u30b9\u524a\u9664\n# skuname\u306fEXCHANGESTANDARD\u3084ENTERPRISEPACK\u7b49\nfunction global:RemoveLicense($user,$skuname) {\n\t# \u524a\u9664\u3059\u308b\u30b5\u30d6\u30b9\u30af\u30ea\u30d7\u30b7\u30e7\u30f3\u30e9\u30a4\u30bb\u30f3\u30b9\u306eSkuId(GUID)\u3092\u53d6\u5f97\n\t$local:sku = get-mgsubscribedsku -all | where-object {$_.SkuPartNumber -eq $skuname}\n\t# UserID\u3092\u53d6\u5f97\n\t$local:uid = get-mguser -userid $user\n\t# \u30e9\u30a4\u30bb\u30f3\u30b9\u524a\u9664(-AddLicenses\u30d1\u30e9\u30e1\u30fc\u30bf\u3082\u5fc5\u9808-\u7a7a\u306e\u30ea\u30b9\u30c8\u3092\u6e21\u3059)\n\tset-mguserlicense -userid $uid.Id -AddLicenses @() -RemoveLicenses @($sku.SkuId)\n}\n<\/code><\/pre><\/div>\n\n\n\n<p>\u3061\u306a\u307f\u306b\u3001Microsoft Graph Powershell Module\u306e\u30b3\u30de\u30f3\u30c9\u30ec\u30c3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u524d\u306b\u306f\u3001Connect-MgGraph\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304a\u304f\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<p>Connect-MgGraph\u30b3\u30de\u30f3\u30c9\u306b\u306f\u3001-Scopes\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u3001User.Read.All,User.ReadWrite.All,Directory.Read.All,Directory.ReadWrite.All\u7b49\u3001\u30b3\u30de\u30f3\u30c9\u5b9f\u884c\u306b\u5fc5\u8981\u306a\u6a29\u9650\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u3002<\/p>\n\n\n\n<p>\u5b9f\u969b\u306b\u8a66\u3057\u3066\u307f\u3066\u3001\u5358\u4f53\u3067\u306f\u554f\u984c\u7121\u304f\u51e6\u7406\u304c\u3067\u304d\u305f\u3002\u307e\u305f\u3001\u9023\u7d9a\u51e6\u7406\u3082(\u540c\u3058\u30a2\u30ab\u30a6\u30f3\u30c8\u306b\u3060\u304c)\u8ffd\u52a0,\u524a\u9664\u3092for\u6587\u306710\u56de\u7e70\u308a\u8fd4\u3057\u3066\u3082\u30a8\u30e9\u30fc\u304c\u51fa\u306a\u304b\u3063\u305f\u306e\u3067\u3001\u591a\u5206\u3001\u554f\u984c\u306f\u7121\u3044\u3068\u601d\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MSOnline Powershell\u30e2\u30b8\u30e5\u30fc\u30eb\u306eSet-MsolUserLic &hellip; <a href=\"https:\/\/sumomo.ohwaki.jp\/wordpress\/?p=732\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,28,29,4],"tags":[],"class_list":["post-732","post","type-post","status-publish","format-standard","hentry","category-microsoft-graph","category-powershell","category-29","category-4"],"_links":{"self":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=732"}],"version-history":[{"count":6,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/732\/revisions"}],"predecessor-version":[{"id":745,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/732\/revisions\/745"}],"wp:attachment":[{"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sumomo.ohwaki.jp\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}