I am deploying a resource into Azure, i have a variable at the project level $OctopusParameters[“Octopus.Deployment.CreatedBy.EmailAddress”] which i want to take the initials of the emailaddress Mick.Jagger@thestones.com. Is this possible?
Welcome to Octopus!
To have a better understanding of what you are trying to do, you have an email address which you can get access to from using the $OctopusParameters[“Octopus.Deployment.CreatedBy.EmailAddress”] variable
You’d like to get the Initials of the email.
If that is correct you can do it in a PowerShell script:
$Email = $OctopusParameters[“Octopus.Deployment.CreatedBy.EmailAddress”]
foreach($X in $Email)
$UserName = $X
$UserInt = $UserName.Substring(0,1) + ($Username -split ‘.’).substring(0,1)
Write-Output “UserName = $UserName `n UserInt = $UserInt”
Once you have your initials, you can now get those in a separate variable and use them how you’d like.
I hope this has helped you.