Azure Automation: WHO AM I

Azure Automation is gaining lot of popularity and it is quite a black box. You author a runbook, publish it and run it. Do you know on which machine the runbook is getting executed and the name of the user account used to execute the runbook?

The answer is that we can figure out!!

You can author a runbook in Azure automation as shown below and execute it. It is output the name of the local machine as well as the user under which the runbook is getting executed.


workflow Whoami
{
inlinescript{
$WindowsID = [System.Security.Principal.WindowsIdentity]::GetCurrent()

$WindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($WindowsID)

$WindowsPrincipal.Identity

}
}

This would print the details about the identity under which the runbook was executing as well as the host or computer name. The result or output would look like below.


IsAnonymous : False
Name : LsaSetupDomain\Administrator
Owner : S-1-5-21-3235083057-2096672557-690217298-500
User : S-1-5-21-3235083057-2096672557-690217298-500
Groups : {S-1-5-21-3235083057-2096672557-690217298-513, S-1-1-0, S-1-5-114, S-1-5-32-544...}
Token : 1012
Claims : {}
Actor :
BootstrapContext :
Label :
NameClaimType : http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name
RoleClaimType : http://schemas.microsoft.com/ws/2008/06/identity/claims/groupsid

The entire thing would like below

AA identity

Note the name shown in yellow. It is LsaSetupDomain\Admninistraor.

Hope you enjoyed this post!

Cheers!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s