%3CLINGO-SUB%20id%3D%22lingo-sub-1150335%22%20slang%3D%22en-US%22%3EHow%20to%20use%20Group%20Managed%20Service%20Accounts%20(gMSA)%20in%20Azure%20Automation%20Hybrid%20Worker%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1150335%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThis%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Epost%20describes%20how%20to%20use%20Azure%20Automation%20Hybrid%20Worker%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ein%20on-premises%20scenarios%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwhere%20you%20need%20to%20authenticate%20against%20the%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Elocal%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eresources%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eyou%20want%20to%20automate%2C%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eall%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ewithout%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eusing%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bany%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAzure%20Automation%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecredential%2Fcertificate%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethanks%20to%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EGroup%20Managed%20Service%20Accounts%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eand%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPsExec%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20aria-level%3D%221%22%20id%3D%22toc-hId--1411845764%22%20id%3D%22toc-hId--1411845770%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EIntroduction%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fautomation-hybrid-runbook-worker%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAzure%20Automation%20Hybrid%20Worker%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bis%20a%20great%20solution%20for%20im%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eplementing%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehybrid%20automation%20scenarios%2C%20w%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehere%20you%20have%20on-premises%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eassets%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Byou%20want%20to%20manipulate%20from%20the%20same%20control%20plane%20you%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Euse%20to%20manage%20your%20Azure%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eresources.%20All%20your%20runbooks%20are%20stored%20and%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Einvok%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eed%20in%20Azure%20Automation%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20but%20you%20choose%20whether%20you%20run%20them%20in%20the%20cloud%20or%20on-premises.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3ENo%20matter%20the%20environment%20you%20are%20managing%2C%20secure%20authentication%20against%20your%20resources%20is%20always%20a%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcritical%20aspect%20of%20your%20automation%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20particularly%20when%20you%20need%20to%20access%20on-premises%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bresources%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3BAzure%20Automation%20provides%20several%20solutions%20for%20authentication%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fmanage-runas-account%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ERun%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3BA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Es%20Accounts%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E(%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eauthenticating%20against%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAzure%20resources%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bonly%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E)%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%E2%80%93%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ea%20service%20principal%20is%20created%20in%20Azure%20AD%20and%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecan%20be%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eassigned%20privileges%20to%20whatever%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAzure%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eresource%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eassociated%20to%20that%20Azure%20AD%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%E2%80%93%20by%20default%2C%20it%20is%20given%20Contributor%20privileges%20in%20the%20Azure%20subscription%20in%20which%20the%20Automation%20Account%20was%20created%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3BThis%20solution%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eis%20normally%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eused%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eby%20hosted%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eworkers%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20but%20can%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ealso%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ebe%20used%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ewith%20Hybrid%20Workers%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B(%3C%2FSPAN%3E%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fautomation-hrw-run-runbooks%23runas-script%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%5B%23%24dp21%5Dsee%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehow%20to%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E)%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fautomation-hrw-run-runbooks%23managed-identities-for-azure-resources%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EManaged%20Identity%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B(authenticating%20against%20Azure%20resources%20only)%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%E2%80%93%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethis%20is%20the%20recommended%20solution%20for%20Hybrid%20Workers%20running%20in%20Azure%2C%20as%20there%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eis%20no%20need%20to%20manage%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eidentity%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecertificates%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Band%20authentication%20is%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Edone%20in%20a%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Emuch%20simpler%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bway%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fshared-resources%2Fcredentials%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ECredential%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fshared-resources%2Fcertificates%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ECertificate%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Band%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fautomation-connections%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EConnection%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bassets%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%E2%80%93%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eshared%20A%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eutomation%20resources%20that%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eboth%20hosted%20and%20Hybrid%20Workers%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcan%20use%20to%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eretrieve%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esecurely%20store%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ed%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcredentials%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bor%20certificates%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bthat%20authenticate%20against%20Azure%20or%20on-premises%20resources.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3ELooking%20at%20the%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bauthentication%20options%20available%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eonly%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecredentials%2Fcertificates%20can%20be%20used%20to%20authenticate%20against%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eon-premises%20resources%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%20However%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esome%20organization%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Es%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bmay%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ebe%20reluctant%20in%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Estoring%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esuch%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esensitive%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Einformation%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ein%20Azure%20Automation%2C%20even%20more%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eretrieving%20it%20over%20the%20Internet.%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3BTherefore%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eif%20Automation%20Hybrid%20Worker%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecould%20use%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ea%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3En%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eon-premises%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eidentity%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwithout%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Edealing%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwith%20secrets%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20such%20as%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fsecurity%2Fgroup-managed-service-accounts%2Fgroup-managed-service-accounts-overview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%5B%23%24dp32%5D%3CSPAN%20data-contrast%3D%22none%22%3EGroup%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EManaged%20Service%20Accounts%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B(%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E)%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20there%20would%20be%20no%20need%20to%20store%20credentials%2Fcertificates.%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3BUnfortunately%2C%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FMicrosoftDocs%2Fazure-docs%2Fissues%2F34858%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAzure%20Automation%20does%20not%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Enatively%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Esupport%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20but%20if%20you%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Efollow%20the%20remainder%20of%20this%20post%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethere%20is%20a%20way%20of%20using%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20thanks%20to%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fsysinternals%2Fdownloads%2Fpsexec%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Btool%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwhich%20can%20be%20used%20to%20launch%20a%20process%20in%20the%20context%20of%20any%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eidentity%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20including%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20aria-level%3D%221%22%20id%3D%22toc-hId-1075667069%22%20id%3D%22toc-hId-1075667063%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ESolution%20architecture%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A240%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThis%20solution%20assumes%20that%20you%20have%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eo%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ene%20or%20more%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAzure%20Automation%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EHybrid%20Workers%20domain-joined%20to%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ean%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eon-premises%20Active%20Directory%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Baccording%20to%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows-server%2Fsecurity%2Fgroup-managed-service-accounts%2Fgetting-started-with-group-managed-service-accounts%23BKMK_gMSA_Req%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%5B%23%24dp43%5DgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Brequirements%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3C%2FSPAN%3E%26nbsp%3B%3CSPAN%20data-contrast%3D%22auto%22%3EThe%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Esame%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eidentity%20can%20be%20used%20across%20multiple%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EHybrid%20Workers%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20as%20it%20is%20centrally%20managed%20by%20Active%20Directory.%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EWith%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Erequir%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eed%20permissions%20assigned%20to%20th%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eat%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Baccount%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EHybrid%20Workers%20can%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ebe%20authorized%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bagainst%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%20resources%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eto%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ep%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ee%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Erform%20automation%20tasks%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Ball%20without%20dealing%20with%20secrets%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAs%20a%20good%20practice%2C%20i%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ef%20you%20plan%20to%20automate%20local%20resources%20in%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eseveral%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eadministrative%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Etiers%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eor%20for%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Emultiple%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Epurposes%20requiring%20different%20permission%20levels%2C%20you%20should%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Econsider%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eus%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eing%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bdistinct%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2FHybrid%20Workers%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Egroups%20for%20each%20administrative%20tier%2Fpermission%20level%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335551550%26quot%3B%3A1%2C%26quot%3B335551620%26quot%3B%3A1%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22clipboard_image_0.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168944iC5CAFFB011F3AF42%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20title%3D%22clipboard_image_0.png%22%20alt%3D%22clipboard_image_0.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20aria-level%3D%221%22%20id%3D%22toc-hId--731787394%22%20id%3D%22toc-hId--731787400%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EImplementation%20details%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EDue%20to%20the%20limited%20scenarios%20in%20which%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSAs%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bcan%20be%20used%2C%20we%20are%20left%20with%20the%20only%20option%20for%20Hybrid%20Workers%3A%20using%20the%20well-known%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Btool%20from%20Microsoft%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ESysinternals%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%2C%20which%20can%20be%20used%20to%20launch%20a%20process%20in%20the%20context%20of%20any%20user%2C%20including%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%20In%20order%20to%20use%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPower%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehell%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bfrom%20end%20to%20end%2C%20one%20can%20use%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FInvokePsExec%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInvoke-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bwrapper%20module%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E%2C%20but%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bexecutable%20can%20also%20be%20directly%20called%20from%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPower%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eh%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eell%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%2C%20provided%20it%20is%20made%20available%20in%20a%20well-known%20local%20directory%20in%20the%20Hybrid%20Worker%20machine.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3EIn%20order%20to%20prepare%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Baccount%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%2C%20you%20must%20follow%20these%20steps%20(a%20good%20overview%20of%20the%20process%20can%20be%20found%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fcore-infrastructure-and-security%2Fwindows-server-2012-group-managed-service-accounts%2Fba-p%2F255910%22%20target%3D%22_blank%22%20rel%3D%22noopener%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehere%3C%2FSPAN%3E%3C%2FA%3E)%3CSPAN%20data-contrast%3D%22none%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E1.%20Create%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EKDS%20Root%20Key%20in%20Active%20Directory%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B(AD)%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20by%20running%20the%20following%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPower%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3ES%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehell%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcommand%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eon%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ea%20domain%20controller%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20data-contrast%3D%22auto%22%3EOption%201%20%E2%80%93%20if%20you%20want%20to%20be%20sure%20the%20KDS%20Root%20Key%20propagates%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eacross%20your%20entire%20A%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ED%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Btopology%20and%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eyou%20can%20wait%20for%20about%2010%20hours%20for%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%20propagation%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bto%20conclude%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EAdd-KdsRootKey%20-EffectiveImmediately%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A720%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSPAN%20data-contrast%3D%22auto%22%3EOption%202%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%E2%80%93%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eif%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3BKDS%20Root%20Key%20propagation%20across%20the%20entire%20AD%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Etopology%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eis%20not%20an%20issue%20in%20your%20scenario%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3EAdd-KdsRootKey%20-EffectiveTime%20((Get-Date).AddHours(-10))%20%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E2.%20C%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ereate%20a%20security%20group%20in%20the%20AD%20for%20the%20purpose%20of%20grouping%20all%20the%20computers%20(Hybrid%20Workers)%20that%20will%20use%20th%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eis%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%20Make%20all%20the%20Hybrid%20Worker%20machines%20as%20members%20of%20this%20security%20group.%26nbsp%3B%3C%2FSPAN%3E%3CU%3EReboot%20the%20Hybrid%20Worker%20machines%3C%2FU%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E3.%20%5Bif%20you%20chose%20option%201%20in%20step%201%2C%20ensure%2010%20hours%20have%20elapsed%5D%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ECreate%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%2C%20by%20executing%20the%20following%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPower%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehell%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcommand%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3ENew-ADServiceAccount%20-Name%20%22%3CGMSA%20name%3D%22%22%3E%22%20-DNSHostName%20%22%3CGMSA%20name%3D%22%22%3E.yourdomain.local%22%20-Enabled%20%24True%20-PrincipalsAllowedToRetrieveManagedPassword%20%3CSECURITY%20group%3D%22%22%20created%3D%22%22%20in%3D%22%22%20the%3D%22%22%20previous%3D%22%22%20step%3D%22%22%3E%20-KerberosEncryptionType%20AES256%20%20%3C%2FSECURITY%3E%3C%2FGMSA%3E%3C%2FGMSA%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3E4.%20Grant%20all%20the%20needed%20privileges%20to%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Baccount.%20When%20looking%20for%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bin%20the%20AD%2C%20refer%20to%20it%20as%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bname%26gt%3B%24%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E5.%20Install%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bin%20the%20Hybrid%20Worker%20machines%20using%20it%2C%20by%20running%20there%20this%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPower%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehell%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcommand%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3EInstall-ADServiceAccount%20-Identity%20%3CGMSA%20name%3D%22%22%3E%20%3C%2FGMSA%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3E6.%20Test%20if%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwas%20correctly%20installed%20in%20the%20Hybrid%20Worker%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3ETest-ADServiceAccount%20-Identity%20%3CGMSA%20name%3D%22%22%3E%20%3C%2FGMSA%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22padding-left%3A%2030px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3ENow%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bthat%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bis%20ready%20to%20be%20used%2C%20we%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emust%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bset%20up%20Azure%20Automation.%20In%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Emany%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Escenario%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Es%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAutomation%20runbooks%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehave%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bhundreds%20of%20lines%2C%20variables%2C%20HTML%20code%2C%20etc.%20Because%20of%20this%20complexity%2C%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ewe%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bmight%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ebe%20obliged%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eto%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Erun%20the%20script%20from%20the%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EHybrid%20Worker%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Elocal%20file%20system%2C%20instead%20of%20just%20passing%20it%20inline%20to%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E.%20However%2C%20as%20we%20don%E2%80%99t%20want%20to%20have%20automation%20code%20permanently%20stored%20in%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EHybrid%20Worker%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Elocal%20file%20system%2C%20we%20will%20use%20two%20Azure%20Automation%20Runbooks%3A%20the%20first%20one%20with%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Borchestration%3B%20and%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eother%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bone%20with%20the%20actual%20automation%20we%20want%20to%20execute%20(please%2C%20note%20that%20it%20won%E2%80%99t%20be%20triggered%20as%20a%20normal%20runbook%2C%20but%20will%20rather%20be%20temporarily%20downloaded%20to%20the%20local%20file%20system%20to%20be%20later%20called%20by%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E).%20To%20make%20this%20solution%20possible%2C%20we%20will%20need%20to%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%221%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EEnsure%20we%20have%20a%20configured%20Azure%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3ERun%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAs%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAccount%20in%20the%20Automation%20Account%20(%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fmanage-runas-account%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Esee%20instructions%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E).%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%222%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInstall%20the%20Azure%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPower%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ehell%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bmodule%20in%20the%20Hybrid%20Worker%20(%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fpowershell%2Fazure%2Finstall-az-ps%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Esee%20instructions%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E).%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInstall%20the%20Azure%26nbsp%3BRun%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAs%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EAccount%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bcertificate%20in%20the%20Hybrid%20Worker%20(%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fautomation%2Fautomation-hrw-run-runbooks%23runas-script%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Esee%20instructions%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E).%20We%20will%20need%20this%20certificate%20to%20connect%20to%20Azure%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eto%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bdownload%20the%20main%20automation%20script.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%224%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInstall%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fwww.powershellgallery.com%2Fpackages%2FInvokePsExec%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInvoke-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bmodule%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bin%20the%20Hybrid%20Worker%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%221%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ECreate%20the%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Borchestration%20Runbook%20(see%20sample%20script%20below).%20This%20runbook%3A%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%222%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%222%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ED%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eownloads%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bthe%20main%20script%20from%20Azure%20Automation%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%222%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Eearches%20and%20replaces%20(in%20the%20main%20script)%20for%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eparameters%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%99%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bplaceholder%20with%20the%20actual%20parameters%20we%20want%20to%20pass%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%222%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%224%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eaves%20the%20final%20script%20in%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ethe%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Elocal%20file%20system%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%222%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%225%22%20data-aria-level%3D%221%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EC%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3Ealls%20Invoke-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bin%20the%20context%20of%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Baccount%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%221%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ECreate%20the%20main%20automation%20Runbook%2C%20ensuring%20we%20assign%20the%20expected%20JSON%20parameters%20variable%20with%20a%20parameters%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%99%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bplaceholder%2C%20e.g.%2C%20%E2%80%9C%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EJSONParametersPlaceHolder%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%9D%20(see%20sample%20script%20below)%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%222%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EInvoke%20the%20orchestration%20runbook%2C%20passing%20to%20it%20the%20required%20parameters%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559685%26quot%3B%3A360%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%0A%3CUL%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%223%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3ERunbookName%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%E2%80%93%20the%20name%20of%20the%20main%20automation%20runbook%20to%20be%20called%20with%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Bin%20the%20context%20of%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%224%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAutomationAccountName%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%E2%80%93%20the%20Automation%20Account%20where%20the%20main%20runbook%20is%20stored%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%225%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EAutomationAccountResourceGroup%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%E2%80%93%26nbsp%3Bresource%26nbsp%3Bgroup%20for%20the%20Automation%20Account%20above%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%225%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSAName%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%E2%80%93%20the%20name%20of%20the%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3Baccount%2C%20in%20the%20format%20of%20%E2%80%9C%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Edomain%5C%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eaccountname%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3E%24%E2%80%9D%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%20data-leveltext%3D%22%EF%82%B7%22%20data-font%3D%22Symbol%22%20data-listid%3D%223%22%20aria-setsize%3D%22-1%22%20data-aria-posinset%3D%225%22%20data-aria-level%3D%222%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EParametersJson%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%E2%80%93%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Ethe%20parameters%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%3CSPAN%20data-contrast%3D%22none%22%3Eto%20send%20to%20the%20main%20runbook%2C%20as%20a%20JSON%20valid%20string%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B134233279%26quot%3B%3Atrue%2C%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20aria-level%3D%222%22%20id%3D%22toc-hId-1755725439%22%20id%3D%22toc-hId-1755725433%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3BOrchestration%20Runbook%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A40%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%26lt%3B%23Sample%20scripts%20provided%20are%20not%20supported%20under%20any%20Microsoft%20standard%20support%20program%20or%20service.%20The%20sample%20scripts%20are%20provided%20AS%20IS%20without%20warranty%20of%20any%20kind.%20Microsoft%20disclaims%20all%20implied%20warranties%20including%2C%20without%20limitation%2C%20any%20implied%20warranties%20of%20merchantability%20or%20of%20fitness%20for%20a%20particular%20purpose.%20The%20entire%20risk%20arising%20out%20of%20the%20use%20or%20performance%20of%20the%20sample%20scripts%20and%20documentation%20remains%20with%20you.%20In%20no%20event%20shall%20Microsoft%2C%20its%20authors%2C%20or%20anyone%20else%20involved%20in%20the%20creation%2C%20production%2C%20or%20delivery%20of%20the%20scripts%20be%20liable%20for%20any%20damages%20whatsoever%20(including%2C%20without%20limitation%2C%20damages%20for%20loss%20of%20business%20profits%2C%20business%20interruption%2C%20loss%20of%20business%20information%2C%20or%20other%20pecuniary%20loss)%20arising%20out%20of%20the%20use%20of%20or%20inability%20to%20use%20the%20sample%20scripts%20or%20documentation%2C%20even%20if%20Microsoft%20has%20been%20advised%20of%20the%20possibility%20of%20such%20damages.%23%26gt%3B%20%20%0A%0AParam(%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%5Bstring%5D%E2%80%AF%24RunbookName%2C%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%5Bstring%5D%E2%80%AF%24AutomationAccountName%2C%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%5Bstring%5D%E2%80%AF%24AutomationAccountResourceGroup%2C%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%5Bstring%5D%E2%80%AF%24gMSAName%2C%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%5Bstring%5D%E2%80%AF%24ParametersJson%20%0A%0A)%20%0A%0A%20%0A%0A%24servicePrincipalConnection%E2%80%AF%3D%E2%80%AFGet-AutomationConnection%E2%80%AF-Name%E2%80%AF%22AzureRunAsConnection%22%20%0A%0A%20%0A%0A%22Logging%E2%80%AFin%E2%80%AFto%E2%80%AFAzure...%22%20%0A%0AAdd-AzAccount%E2%80%AF%60%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF-ServicePrincipal%E2%80%AF%60%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF-TenantId%E2%80%AF%24servicePrincipalConnection.TenantId%E2%80%AF%60%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF-ApplicationId%E2%80%AF%24servicePrincipalConnection.ApplicationId%E2%80%AF%60%20%0A%0A%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF-CertificateThumbprint%E2%80%AF%24servicePrincipalConnection.CertificateThumbprint%E2%80%AF%20%0A%0AExport-AzAutomationRunbook%E2%80%AF-ResourceGroupName%E2%80%AF%24AutomationAccountResourceGroup%E2%80%AF-AutomationAccountName%E2%80%AF%24AutomationAccountName%E2%80%AF-Name%E2%80%AF%24RunbookName%E2%80%AF-Slot%E2%80%AFPublished%E2%80%AF-OutputFolder%E2%80%AF.%20%0A%0A%24ScriptFilePath%E2%80%AF%3D%E2%80%AF(Get-Item%E2%80%AF-Path%E2%80%AF%22.%5C%22).FullName%E2%80%AF%2B%E2%80%AF%22%5C%22%E2%80%AF%2B%E2%80%AF%24RunbookName%E2%80%AF%2B%E2%80%AF%22.ps1%22%20%0A%0AWrite-Output%E2%80%AF%22Replacing%E2%80%AFJSONParametersPlaceHolder%E2%80%AFwith%E2%80%AF%24ParametersJson%E2%80%AF...%22%20%0A%0A(Get-Content%E2%80%AF%24ScriptFilePath).replace('JSONParametersPlaceHolder'%2C%E2%80%AF%24ParametersJson)%E2%80%AF%7C%E2%80%AFSet-Content%E2%80%AF%24ScriptFilePath%20%0A%0AWrite-Output%E2%80%AF%22Using%E2%80%AFcredential%E2%80%AF%24gMSAName%E2%80%AF...%22%20%0A%0A%23%E2%80%AF%20we%E2%80%AFmust%E2%80%AFuse%E2%80%AF~%E2%80%AFas%E2%80%AFa%E2%80%AFpassword%E2%80%AFreplacement%20for%E2%80%AFthe%E2%80%AFgMSA%E2%80%AFaccount%20%0A%0A%24creds%E2%80%AF%3D%E2%80%AFNew-Object%E2%80%AFSystem.Management.Automation.PSCredential%E2%80%AF(%24gMSAName%2C%E2%80%AF(ConvertTo-SecureString%E2%80%AF%22~%22%E2%80%AF-AsPlainText%E2%80%AF-Force))%20%0A%0AInvoke-PsExec%E2%80%AF-Credential%E2%80%AF%24creds%E2%80%AF-ComputerName%E2%80%AF%24env%3Acomputername%E2%80%AF-PSFile%E2%80%AF%24ScriptFilePath%20%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20aria-level%3D%222%22%20id%3D%22toc-hId--51729024%22%20id%3D%22toc-hId--51729030%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EMain%20automation%20Runbook%20sample%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A40%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22none%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-csharp%22%3E%3CCODE%3E%24ParametersJson%E2%80%AF%E2%80%AF%E2%80%AF%E2%80%AF%3D%E2%80%AF%E2%80%AF%E2%80%AF%22JSONParametersPlaceHolder%22%20%0A%0A%26lt%3B%23%20%0AAs%E2%80%AFan%E2%80%AFexample%2C%E2%80%AFwe%E2%80%AFare%E2%80%AFgoing%E2%80%AFto%E2%80%AFdisable%E2%80%AFa%E2%80%AFuser%E2%80%AFaccount%E2%80%AFsent%E2%80%AFas%E2%80%AFa%E2%80%AFJSON%E2%80%AFparameter%2C%E2%80%AFwith%E2%80%AFthe%E2%80%AFschema%E2%80%AF%7B%E2%80%AF'Name'%3A%E2%80%AF'Account%E2%80%AFName'%2C%E2%80%AF'SamAccountName'%E2%80%AF%3A%E2%80%AF'SAM%E2%80%AFaccount%E2%80%AFname'%E2%80%AF%7D%20%0A%23%26gt%3B%20%0A%0A%24user%E2%80%AF%3D%E2%80%AFConvertFrom-Json%E2%80%AF-InputObject%E2%80%AF%24ParametersJson%20%0A%0AWrite-Output%E2%80%AF%22About%E2%80%AFto%E2%80%AFdisable%E2%80%AF%24(%24user.Name)...%22%20%0A%0ADisable-ADAccount%E2%80%AF%24user.SamAccountName%20%0A%0AWrite-Output%E2%80%AF%22Done.%22%20%0A%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId--1859183487%22%20id%3D%22toc-hId--1859183493%22%3E%26nbsp%3B%3C%2FH2%3E%0A%3CH2%20id%3D%22toc-hId-628329346%22%20id%3D%22toc-hId-628329340%22%3E%3CSPAN%20data-contrast%3D%22none%22%3EConclusion%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559738%26quot%3B%3A240%2C%26quot%3B335559739%26quot%3B%3A0%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThis%20post%20describe%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ed%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bhow%20to%20use%20Azure%20Automation%20Hybrid%20Worker%20in%20scenarios%20where%20you%20need%20to%20authenticate%20against%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eon-premises%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eresources%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bwithout%20using%20secrets%20or%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecertificates%2C%20thanks%20to%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Baccounts%20and%26nbsp%3B%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPsExec%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20data-contrast%3D%22auto%22%3EThe%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eorchestration%20runbook%20and%20main%20automation%20sample%20script%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eabove%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eare%20an%20example%20of%20a%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Emore%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ecomplex%20scenario%2C%20in%20which%20you%20need%20to%20pass%20parameters%20to%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Emain%20script.%20However%2C%20if%20the%20command%20to%20execute%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ein%20the%20context%20of%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EgMSA%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Baccount%20is%20simple%20enough%2C%20you%20can%20call%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ethe%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPower%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ES%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Ehell%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcommand%20right%20from%20the%20Invoke-%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EPsExec%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Bcmdlet%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E%26nbsp%3Band%20you%20don%E2%80%99t%20even%20need%20to%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Euse%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3EAzure%20Automation%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3ERun%20As%20Accounts%20as%20you%20don%E2%80%99t%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Eneed%20to%20export%20the%26nbsp%3B%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3Emain%20script%20to%20the%20local%20file%20system%3C%2FSPAN%3E%3CSPAN%20data-contrast%3D%22auto%22%3E.%3C%2FSPAN%3E%3CSPAN%20data-ccp-props%3D%22%7B%26quot%3B201341983%26quot%3B%3A0%2C%26quot%3B335559739%26quot%3B%3A160%2C%26quot%3B335559740%26quot%3B%3A259%7D%22%3E%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1150335%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22using-gmsa-identity-azure-automation-hybrid-worker-small.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F168956i4C4C7C497FD2114E%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22using-gmsa-identity-azure-automation-hybrid-worker-small.jpg%22%20alt%3D%22using-gmsa-identity-azure-automation-hybrid-worker-small.jpg%22%20%2F%3E%3C%2FSPAN%3ELearn%20how%20to%20use%20Azure%20Automation%20Hybrid%20Worker%20in%20on-premises%20scenarios%20where%20you%20need%20to%20authenticate%20against%20local%20resources%20using%20Group%20Managed%20Service%20Accounts%20(gMSA)%20and%20PsExec%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1150335%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EHelderPinto%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Microsoft

 

This post describes how to use Azure Automation Hybrid Worker in on-premises scenarios where you need to authenticate against the local resources you want to automate, all without using any Azure Automation credential/certificatethanks to Group Managed Service Accounts and PsExec. 

 

Introduction

 

Azure Automation Hybrid Worker is a great solution for implementing hybrid automation scenarios, where you have on-premises assets you want to manipulate from the same control plane you use to manage your Azure resources. All your runbooks are stored and invoked in Azure Automation, but you choose whether you run them in the cloud or on-premises. 

 

No matter the environment you are managing, secure authentication against your resources is always a critical aspect of your automation, particularly when you need to access on-premises resources. Azure Automation provides several solutions for authentication: 

 

  1. Run As Accounts (authenticating against Azure resources only)  a service principal is created in Azure AD and can be assigned privileges to whatever Azure resource associated to that Azure AD – by default, it is given Contributor privileges in the Azure subscription in which the Automation Account was created. This solution is normally used by hosted workers, but can also be used with Hybrid Workers (see how to). 
  2. Managed Identity (authenticating against Azure resources only)  this is the recommended solution for Hybrid Workers running in Azure, as there is no need to manage identity certificates and authentication is done in a much simpler way 
  3. CredentialCertificate and Connection assets  shared Automation resources that both hosted and Hybrid Workers can use to retrieve securely stored credentials or certificates that authenticate against Azure or on-premises resources. 

Looking at the authentication options available, only credentials/certificates can be used to authenticate against on-premises resources. However, some organizations may be reluctant in storing such sensitive information in Azure Automation, even more retrieving it over the Internet. Therefore, if Automation Hybrid Worker could use an on-premises identity without dealing with secrets, such as Group Managed Service Accounts (gMSA), there would be no need to store credentials/certificates. Unfortunately, Azure Automation does not natively support gMSA, but if you follow the remainder of this post, there is a way of using gMSA, thanks to the PsExec tool, which can be used to launch a process in the context of any identity, including gMSA. 

 

Solution architecture 

 

This solution assumes that you have one or more Azure Automation Hybrid Workers domain-joined to an on-premises Active Directory according to gMSA requirements. The same gMSA identity can be used across multiple Hybrid Workers, as it is centrally managed by Active Directory. With the required permissions assigned to that gMSA account, Hybrid Workers can be authorized against the resources to perform automation tasks all without dealing with secrets. 

 

As a good practice, if you plan to automate local resources in several administrative tiers or for multiple purposes requiring different permission levels, you should consider using distinct gMSA/Hybrid Workers groups for each administrative tier/permission level. 

 

On-premises Hybrid Workers, orchestrated by Azure Automation and depending on local Domain Controllers to get the gMSA account required to access local resourcesOn-premises Hybrid Workers, orchestrated by Azure Automation and depending on local Domain Controllers to get the gMSA account required to access local resources

 

Implementation details

 

Due to the limited scenarios in which gMSAs can be used, we are left with the only option for Hybrid Workers: using the well-known PsExec tool from Microsoft Sysinternals, which can be used to launch a process in the context of any user, including gMSA. In order to use PowerShell from end to end, one can use the Invoke-PsExec wrapper module, but the PsExec executable can also be directly called from PowerShell, provided it is made available in a well-known local directory in the Hybrid Worker machine. 

 

In order to prepare the gMSA account, you must follow these steps (a good overview of the process can be found here): 

 

1. Create the KDS Root Key in Active Directory (AD), by running the following PowerShell command on a domain controller: 

 

  • Option 1 – if you want to be sure the KDS Root Key propagates across your entire AD topology and you can wait for about 10 hours for the propagation to conclude: 

 

 

Add-KdsRootKey -EffectiveImmediately

 

 

  • Option 2 – if KDS Root Key propagation across the entire AD topology is not an issue in your scenario: 

 

 

Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10)) 

 

 

2. Create a security group in the AD for the purpose of grouping all the computers (Hybrid Workers) that will use this gMSA. Make all the Hybrid Worker machines as members of this security group. Reboot the Hybrid Worker machines. 

 

3. [if you chose option 1 in step 1, ensure 10 hours have elapsed] Create the gMSA, by executing the following PowerShell command: 

 

 

New-ADServiceAccount -Name "<gMSA name>" -DNSHostName "<gMSA name>.yourdomain.local" -Enabled $True -PrincipalsAllowedToRetrieveManagedPassword <security group created in the previous step> -KerberosEncryptionType AES256  

 

 

4. Grant all the needed privileges to the gMSA account. When looking for the gMSA in the AD, refer to it as <gMSA name>$ 

 

5. Install the gMSA in the Hybrid Worker machines using it, by running there this PowerShell command: 

 

 

Install-ADServiceAccount -Identity <gMSA name> 

 

 

6. Test if the gMSA was correctly installed in the Hybrid Worker: 

 

 

Test-ADServiceAccount -Identity <gMSA name> 

 

 

Now that the gMSA is ready to be used, we must set up Azure Automation. In many scenariosAutomation runbooks have hundreds of lines, variables, HTML code, etc. Because of this complexity, we might be obliged to run the script from the Hybrid Worker local file system, instead of just passing it inline to PsExec. However, as we don’t want to have automation code permanently stored in the Hybrid Worker local file system, we will use two Azure Automation Runbooks: the first one with the PsExec orchestration; and the other one with the actual automation we want to execute (please, note that it won’t be triggered as a normal runbook, but will rather be temporarily downloaded to the local file system to be later called by PsExec). To make this solution possible, we will need to: 

 

  • Ensure we have a configured Azure RunAs Account in the Automation Account (see instructions). 
  • Install the Azure PowerShell module in the Hybrid Worker (see instructions). 
  • Install the Azure RunAs Account certificate in the Hybrid Worker (see instructions). We will need this certificate to connect to Azure to download the main automation script. 
  • Install the Invoke-PsExec module in the Hybrid Worker 
  • Create the PsExec orchestration Runbook (see sample script below). This runbook: 
    • Downloads the main script from Azure Automation 
    • Searches and replaces (in the main script) for the parameters placeholder with the actual parameters we want to pass 
    • Saves the final script in the local file system 
    • Calls Invoke-PsExec in the context of the gMSA account 
  • Create the main automation Runbook, ensuring we assign the expected JSON parameters variable with a parameters placeholder, e.g., “JSONParametersPlaceHolder” (see sample script below) 
  • Invoke the orchestration runbook, passing to it the required parameters 
    • RunbookName – the name of the main automation runbook to be called with PsExec in the context of gMSA
    • AutomationAccountName – the Automation Account where the main runbook is stored 
    • AutomationAccountResourceGroup – resource group for the Automation Account above 
    • gMSAName – the name of the gMSA account, in the format of “domain\accountname$” 
    • ParametersJson  the parameters to send to the main runbook, as a JSON valid string 

 

PsExec Orchestration Runbook 

 

 

<#Sample scripts provided are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages.#>  

Param( 

    [string] $RunbookName, 

    [string] $AutomationAccountName, 

    [string] $AutomationAccountResourceGroup, 

    [string] $gMSAName, 

    [string] $ParametersJson 

) 

 

$servicePrincipalConnection = Get-AutomationConnection -Name "AzureRunAsConnection" 

 

"Logging in to Azure..." 

Add-AzAccount ` 

    -ServicePrincipal ` 

    -TenantId $servicePrincipalConnection.TenantId ` 

    -ApplicationId $servicePrincipalConnection.ApplicationId ` 

    -CertificateThumbprint $servicePrincipalConnection.CertificateThumbprint  

Export-AzAutomationRunbook -ResourceGroupName $AutomationAccountResourceGroup -AutomationAccountName $AutomationAccountName -Name $RunbookName -Slot Published -OutputFolder . 

$ScriptFilePath = (Get-Item -Path ".\").FullName + "\" + $RunbookName + ".ps1" 

Write-Output "Replacing JSONParametersPlaceHolder with $ParametersJson ..." 

(Get-Content $ScriptFilePath).replace('JSONParametersPlaceHolder', $ParametersJson) | Set-Content $ScriptFilePath 

Write-Output "Using credential $gMSAName ..." 

#  we must use ~ as a password replacement for the gMSA account 

$creds = New-Object System.Management.Automation.PSCredential ($gMSAName, (ConvertTo-SecureString "~" -AsPlainText -Force)) 

Invoke-PsExec -Credential $creds -ComputerName $env:computername -PSFile $ScriptFilePath 

 

 

Main automation Runbook sample 

 

 

$ParametersJson    =   "JSONParametersPlaceHolder" 

<# 
As an example, we are going to disable a user account sent as a JSON parameter, with the schema { 'Name': 'Account Name', 'SamAccountName' : 'SAM account name' } 
#> 

$user = ConvertFrom-Json -InputObject $ParametersJson 

Write-Output "About to disable $($user.Name)..." 

Disable-ADAccount $user.SamAccountName 

Write-Output "Done." 

 

 

Conclusion 

 

This post described how to use Azure Automation Hybrid Worker in scenarios where you need to authenticate against on-premises resources without using secrets or certificates, thanks to gMSA accounts and PsExec.  

 

The orchestration runbook and main automation sample script above are an example of a more complex scenario, in which you need to pass parameters to the main script. However, if the command to execute in the context of the gMSA account is simple enough, you can call the PowerShell command right from the Invoke-PsExec cmdlet and you don’t even need to use Azure Automation Run As Accounts as you don’t need to export the main script to the local file system. 

 

Thanks for reading!