{"id":2883,"date":"2018-07-25T11:01:15","date_gmt":"2018-07-25T10:01:15","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=2883"},"modified":"2018-07-25T11:01:15","modified_gmt":"2018-07-25T10:01:15","slug":"retrieving-a-headless-silent-token-for-main-iam-ad-ext-azure-com-using-powershell","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2018\/07\/retrieving-a-headless-silent-token-for-main-iam-ad-ext-azure-com-using-powershell\/","title":{"rendered":"Retrieving a headless silent token for main.iam.ad.ext.azure.com using Powershell"},"content":{"rendered":"<p>A lot of the things we can click on in the Azure Portal cannot be done through Powershell Cmdlets published by Microsoft.<\/p>\n<p>However, using Fiddler, we can see that there is a &#8216;hidden&#8217; API we can use, for example, to <a href=\"https:\/\/www.lieben.nu\/liebensraum\/2018\/04\/how-to-grant-oauth2-permissions-to-an-azure-ad-application-using-powershell-unattended-silently\/\">set permissions.<\/a>\u00a0I&#8217;ve written a &#8216;clean&#8217; function to retrieve this token silently that you can use in your scripts, it is not compatible with MFA.<\/p>\n<p><a href=\"https:\/\/github.com\/jflieben\/assortedFunctionsV2\/blob\/main\/get-azureRMtoken.ps1\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/jflieben\/assortedFunctionsV2\/blob\/main\/get-azureRMtoken.ps1<\/a><\/p>\n<p>Please be careful using this for production workflows as this is NOT supported by Microsoft.<\/p>\n<p><strong>UPDATE<\/strong>: <a href=\"https:\/\/www.lieben.nu\/liebensraum\/2020\/04\/calling-graph-and-other-apis-silently-for-an-mfa-enabled-account\/\">Newer \/ mfa compatible version of this function<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A lot of the things we can click on in the Azure Portal cannot be done through Powershell Cmdlets published by Microsoft. However, using Fiddler, we can see that there is a &#8216;hidden&#8217; API we can use, for example, to set permissions.\u00a0I&#8217;ve written a &#8216;clean&#8217; function to retrieve this token silently that you can use &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2018\/07\/retrieving-a-headless-silent-token-for-main-iam-ad-ext-azure-com-using-powershell\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Retrieving a headless silent token for main.iam.ad.ext.azure.com using Powershell<\/span> <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":{"_crdt_document":"","footnotes":""},"categories":[5,39],"tags":[],"class_list":["post-2883","post","type-post","status-publish","format-standard","hentry","category-azure","category-powershell"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/2883","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=2883"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/2883\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=2883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=2883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=2883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}