{"id":3391,"date":"2020-01-14T10:27:15","date_gmt":"2020-01-14T09:27:15","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=3391"},"modified":"2020-01-14T10:27:15","modified_gmt":"2020-01-14T09:27:15","slug":"automatically-detecting-azure-or-office-365-tenant-id","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2020\/01\/automatically-detecting-azure-or-office-365-tenant-id\/","title":{"rendered":"Automatically detecting Azure or office 365 tenant ID"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">A simple snippet you can use in your scripts to automatically detect a tenant ID based on your user&#8217;s email, login or domain:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n$tenantId = (Invoke-RestMethod \"https:\/\/login.windows.net\/$($UserName.Split(\"@\")&#x5B;1])\/.well-known\/openid-configuration\" -Method GET).userinfo_endpoint.Split(\"\/\")&#x5B;3]\n\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>A simple snippet you can use in your scripts to automatically detect a tenant ID based on your user&#8217;s email, login or domain:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[4,7,32,39],"tags":[],"class_list":["post-3391","post","type-post","status-publish","format-standard","hentry","category-automation","category-azuread","category-office-365","category-powershell"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3391","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=3391"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/3391\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=3391"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=3391"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=3391"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}