signing powershell


We signed our powershell script, having identified the indes of the signing cert in the list enumerate by powershell

image

We simply followed the instructions, here, to make the signing credentials – in the visual studio invoked command tool.

image

image

This gives us:

 

1 param([string[]]$args) 2 3 4 $msolcred = Get-Credential -UserName admin@netmagic.onmicrosoft.com ` 5 -Message "password for netmagic is Rapattoni1!" 6 Connect-MsolService -Credential $msolcred -ErrorAction Stop 7 8 $setfed = Get-MsolDomainFederationSettings -DomainName "rapmlsqa.com" 9 $alog = $setfed.ActiveLogOnUri 10 11 $strarr = $alog.Split('/') 12 $len = $strarr.Length 13 14 #colc/8/BARS 15 #appid/linkid/mlsid 16 17 18 $mlsid = $strarr[$len - 1] 19 $linkid = $strarr[$len - 2] 20 $appid = $strarr[$len - 3] 21 22 23 Get-MsolDomainFederationSettings -DomainName "rapmlsqa.com" -Verbose 24 25 26 echo $mlsid 27 echo $linkid 28 echo $appid 29 30 foreach ($name in $args) { 31 32 $upn = $name + "@rapmlsqa.com" 33 34 $displayname = $name + "_at_Rapattoni" 35 36 $someString = $name + $appID + $mlsID 37 $bytes = [System.Text.Encoding]::Default.GetBytes($somestring) 38 $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider 39 $hashbytes = $md5.ComputeHash($bytes) 40 $result = [GUID]($hashbytes) 41 $resultstring = $result.ToString(); 42 $resultstringbytes = [System.Text.Encoding]::Default.GetBytes($resultstring) 43 44 $base64 = [System.Convert]::ToBase64String($resultstringbytes) 45 46 $msoluser = Get-MsolUser -UserPrincipalName $upn 47 48 Get-MsolUser -UserPrincipalName $upn -Verbose 49 50 echo "new-msolUser –userprincipalname $upn -immutableID $base64 -lastname At_Rapattoni –firstname $name –Displayname $displayname -BlockCredential `$false" 51 } 52 53 54 # SIG # Begin signature block 55 # MIIFuQYJKoZIhvcNAQcCoIIFqjCCBaYCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB 56 # gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfv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TaGwgaf9LI8Z7wGfqLpGJ92j2S6uIAk3Ww8HSB4TyvF 73 # ZrHAx1YIcFnKUk6ItY0ElOVnUzPc6OaFmO+jHtAXqNWLwpyPBF5d4ZoxPBSEqBWp 74 # ARzxqpXtXvdnB0zqMMdmaW6raC3BVzslOHpC8GdUkNV7vakbzf60BNy5cWwuc7FB 75 # ckrf1oZWvkXgF24T1S1yOhjq+jp+5OaiMYIB4TCCAd0CAQEwQDAsMSowKAYDVQQD 76 # EyFQb3dlclNoZWxsIExvY2FsIENlcnRpZmljYXRlIFJvb3QCEPqN+Kv4s3mJQW/Q 77 # vIkyjcQwCQYFKw4DAhoFAKB4MBgGCisGAQQBgjcCAQwxCjAIoAKAAKECgAAwGQYJ 78 # KoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIBCzEOMAwGCisGAQQB 79 # gjcCARUwIwYJKoZIhvcNAQkEMRYEFHnUbgCdPI1Dj56IhWGiLZ0UdC3YMA0GCSqG 80 # SIb3DQEBAQUABIIBAA6FcaBW+FqtOEpeM1I5KrIo77+1cbQeStkO1Iij0AERKXMv 81 # ay+Vedh8Zp9skwXrZ8CDSVbr+B1oOchahR665SRX7E194vIMpzeECqo1Wr0gtDWy 82 # ikMXslVx+dx1u2SFbgEvcwCS9ZBic6lYQutWTua06AKl6ebnFm3NEbIgOjxwot0X 83 # eaQq+Z6YvClMjBnctP8YqidRtrN8NL1c1pMErdG9FmtEIiXWsDmWcixV3qUHxHqz 84 # PM89IcpdqWtGoZl94VV4jOAtpaq5kUhYpPdcdmizvmTixo1lBvfVBggbr+2sAbpQ 85 # XinVRtVs/N75bvMloy3XnsCJzg7OaAivjwMKu90= 86 # SIG # End signature block

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in dunno. Bookmark the permalink.