%3CLINGO-SUB%20id%3D%22lingo-sub-1436154%22%20slang%3D%22en-US%22%3ESigning%20a%20MSIX%20package%20with%20Azure%20Key%20Vault%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1436154%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3ESigning%20is%20one%20of%20the%20most%20critical%20aspects%20when%20working%20with%20MSIX%20packages.%20One%20of%20the%20key%20goals%20of%20MSIX%20as%20deployment%20technology%20is%20to%20ensure%20safety%20and%20trust%20and%20signing%20is%20one%20of%20the%20ways%20to%20achieve%20it.%20Thanks%20to%20signing%2C%20we%20are%20sure%20that%20the%20application%20we're%20about%20to%20install%20is%20coming%20from%20a%20trusted%20publisher%20and%20not%20from%20a%20potentially%20malicious%20developer.%20Certification%20authorities%20(either%20enterprise%20or%20public%20ones)%20have%20a%20rigorous%20background%20check%20process%2C%20which%20makes%20sure%20that%20when%20you%20request%20a%20certificate%20under%20a%20name%20or%20a%20brand%2C%20you're%20indeed%20the%20person%20or%20the%20company%20you%20claim%20to%20be.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22certificate.png%22%20style%3D%22width%3A%20699px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196145iC2A09D2619EF1882%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22certificate.png%22%20alt%3D%22certificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFor%20the%20same%20reason%2C%20certificates%20must%20be%20stored%20safely%20to%20avoid%20any%20identity%20theft.%20If%20we%20would%20expose%20the%20private%20key%20of%20the%20certificate%20on%20a%20public%20repository%2C%20for%20example%2C%20other%20developers%20could%20reuse%20it%20and%20sign%20other%20applications%20with%20our%20identity.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20such%2C%20especially%20when%20we%20want%20to%20implement%20a%20CI%2FCD%20pipeline%20to%20continuously%20build%20and%20deploy%20our%20desktop%20applications%2C%20we%20need%20to%20find%20the%20right%20balance%20between%20safety%20and%20convenience.%20We%20want%20to%20make%20it%20easy%20to%20sign%20our%20packages%20with%20our%20certificates%20as%20part%20of%20the%20process%3B%20at%20the%20same%20time%2C%20we%20must%20do%20it%20without%20compromising%20the%20private%20key.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere%20are%20various%20options%20to%20achieve%20this%20goal.%20In%20this%20post%2C%20we're%20going%20to%20focus%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fkey-vault%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Key%20Vault%3C%2FA%3E%2C%20a%20service%20provided%20by%20Azure%20which%20allows%20to%20store%20in%20a%20safe%20way%20keys%2C%20secrets%20and%20certificates.%20Azure%20Key%20Vault%20is%20a%20critical%20service%20for%20many%20scenarios%3A%20as%20developers%2C%20for%20example%2C%20we%20can%20use%20it%20to%20store%20the%20connection%20strings%20to%20our%20database%3B%20or%20the%20secrets%20to%20connect%20to%20a%203rd%20part%20service%2C%20like%20a%20protected%20API.%20Thanks%20to%20the%20APIs%20offered%20by%20Azure%20Key%20Vault%2C%20we%20can%20retrieve%20the%20protected%20information%20at%20runtime%2C%20without%20having%20to%20expose%20them%20in%20the%20source%20code%20or%20in%20a%20configuration%20file.%20Among%20the%20various%20features%20offered%20by%20Azure%20Key%20Vault%2C%20we%20can%20use%20it%20also%20to%20store%20certificates.%20We%20can%20use%20it%20to%20acquire%2C%20generate%20and%20renew%20certificates%20from%20a%20public%20authority%2C%20relieving%20us%20from%20all%20the%20troubles%20of%20certificates%20management.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20post%20we're%20going%20to%20see%20how%20we%20can%20store%20on%20Azure%20Key%20Vault%20a%20certificate%20we%20own%20and%20then%20use%20it%20to%20sign%20a%20MSIX%20package%20using%20an%20open%20source%20tool%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fvcsjones%2FAzureSignTool%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noopener%20noreferrer%20noopener%20noreferrer%22%3EAzure%20Sign%20Tool%2C%3C%2FA%3E%26nbsp%3Bdeveloped%20by%20%3CA%20href%3D%22https%3A%2F%2Fvcsjones.dev%2F%22%20target%3D%22_self%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3EKevin%20Jones%3C%2FA%3E.%20In%20the%20end%2C%20we're%20going%20to%20see%20how%20we%20can%20integrate%20it%20in%20our%20CI%2FCD%20pipeline%20on%20Azure%20DevOps%20or%20GitHub.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22setup-azure-key-vault%22%20id%3D%22toc-hId-1170388393%22%20id%3D%22toc-hId-1170388393%22%3ESetup%20Azure%20Key%20Vault%3C%2FH3%3E%0A%3CP%3EAs%20first%20step%2C%20you%20must%20login%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-Azure%20Portal%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewith%20your%20Azure%20credentials.%20Click%20on%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%20a%20resource%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ebutton%20and%2C%20using%20the%20internal%20search%2C%20look%20for%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EKey%20Vault%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KeyVault.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196146i7C84FA3FA6A0C336%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22KeyVault.png%22%20alt%3D%22KeyVault.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EClick%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20kick%20start%20the%20provisioning%20process.%20There%20are%20only%20a%20few%20required%20settings%20to%20setup%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%20id%3D%22pragma-line-21%22%3EName%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-22%22%3ERegion%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-23%22%3EPricing%20tier%3A%20for%20this%20post%20I'm%20going%20to%20use%20the%20default%20one.%20However%2C%20if%20you%20really%20care%20about%20security%2C%20you%20should%20consider%20the%20Premium%20tier%2C%20which%20supports%20to%20store%20secret%20and%20keys%20backed%20by%20Hardware%20Security%20Modules.%3C%2FLI%3E%0A%3CLI%20id%3D%22pragma-line-24%22%3ERetention%20period%20(leave%20the%20default%20value%20of%2090%20days)%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22KeyVaultSetup.png%22%20style%3D%22width%3A%20776px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196147i6BC7104C0861B5F2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22KeyVaultSetup.png%22%20alt%3D%22KeyVaultSetup.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EOnce%20you're%20done%2C%20click%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EReview%20%2B%20create%3C%2FSTRONG%3E%3CSPAN%3E%2C%20followed%20by%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bbutton%20to%20complete%20the%20deployment.%20Once%20it's%20completed%2C%20go%20to%20the%20resource.%20We're%20now%20ready%20to%20import%20our%20certificate.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22create-or-import-the-certificate%22%20id%3D%22toc-hId--637066070%22%20id%3D%22toc-hId--637066070%22%3ECreate%20or%20import%20the%20certificate%3C%2FH3%3E%0A%3CP%3EBefore%20you%20start%20you%20need%20to%20decide%20which%20kind%20of%20certificate%20you're%20going%20to%20use.%20Ideally%2C%20you%20should%20have%20acquired%20it%20from%20a%20certificate%20authority%20like%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-DigiCert.%20These%20certificates%20are%20the%20best%20to%20use%20for%20public%20distribution%2C%20since%20they%20are%20automatically%20trusted%20by%20Windows%2010.%20As%20such%2C%20the%20user%20won't%20have%20to%20do%20anything%20special%20to%20install%20your%20application.%20If%20you%20don't%20have%20one%20and%20you%20aren't%20willing%20to%20buy%20one%20for%20the%20moment%2C%20you%20can%20also%20generate%20a%20self-signing%20certificate%20directly%20through%20the%20portal.%20It%20isn't%20the%20ideal%20solution%20for%20publicly%20distributing%20an%20application%20since%20these%20certificates%20can't%20validate%20the%20identify%20of%20the%20person%20%2F%20company%20and%2C%20as%20such%2C%20they%20aren't%20implicitly%20trusted%20by%20Windows.%20The%20user%20will%20need%20to%20manually%20trust%20the%20certificate%2C%20which%20requires%20administrator%20rights.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20self-signing%20certificates%20are%20good%20enough%20for%20testing%2C%20so%20let's%20use%20this%20approach.%20In%20the%20Key%20Vault%20you%20have%20just%20created%20move%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECertificate%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EGenerate%2FImport%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NewCertificate.png%22%20style%3D%22width%3A%20939px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196148iAB1027811613CD8A%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22NewCertificate.png%22%20alt%3D%22NewCertificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3ELet's%20start%20the%20process%20to%20generate%20a%20new%20self-signed%20certificate.%20This%20is%20the%20setup%20screen%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CreateCertificate.png%22%20style%3D%22width%3A%20676px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196149i5EAD71C42EEE0290%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CreateCertificate.png%22%20alt%3D%22CreateCertificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThese%20are%20the%20values%20to%20configure%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EMethod%20or%20Certificate%20creation%3C%2FSTRONG%3E%3A%20since%20we're%20creating%20a%20new%20certificate%2C%20leave%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EGenerate%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECertificate%20Name%3C%2FSTRONG%3E%3A%20this%20name%20identifies%20your%20certificate.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EType%20or%20Certificate%20Authority%20(CA)%3C%2FSTRONG%3E%3A%20leave%20self-signed%20certificate.%20Eventually%2C%20you%20can%20change%20this%20option%20to%20start%20the%20process%20to%20directly%20purchase%20a%20certificate%20from%20a%20public%20CA%20and%20store%20it%20in%20Key%20Vault.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ESubject%3C%2FSTRONG%3E%3A%20this%20field%20is%20very%20important%20because%20it%20must%20match%20the%20Publisher%20you're%20going%20to%20use%20in%20the%20manifest%20of%20your%20MSIX%20package.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3ELeave%20all%20the%20other%20settings%20with%20the%20default%20value.%20However%2C%20there's%20one%20last%20important%20section%20to%20setup%3A%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdvanced%20Policy%20Configuration%3C%2FSTRONG%3E.%20If%20we%20click%20on%20it%2C%20we%20will%20have%20access%20to%20various%20advanced%20options%20for%20the%20certificate.%20The%20most%20important%20one%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EEktended%20Key%20Usage%20(EKUs)%3C%2FSTRONG%3E%2C%20which%20specifies%20the%20various%20use%20cases%20supported%20by%20the%20certificate.%20As%20per%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-the%20documentation%2C%20in%20order%20to%20use%20a%20certificate%20to%20sign%20a%20MSIX%20package%20we%20need%20to%20enable%20the%20following%20EKUs%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E1.3.6.1.5.5.7.3.3%20indicates%20that%20the%20certificate%20is%20valid%20for%20code%20signing.%3C%2FLI%3E%0A%3CLI%3E1.3.6.1.4.1.311.10.3.13%20indicates%20that%20the%20certificate%20respects%20lifetime%20signing.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3EAs%20such%2C%20you%20need%20to%20replace%20the%20existing%20values%20with%20these%20two%20ones%2C%20separated%20by%20a%20comma.%20Another%20setting%20that%20you%20may%20want%20to%20configure%2C%20in%20order%20to%20get%20better%20security%2C%20is%20to%20set%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EExportable%20Private%20Key%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bto%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENo%3C%2FSTRONG%3E%3CSPAN%3E.%20This%20way%2C%20even%20if%20you%20store%20the%20certificate%20locally%2C%20you%20won't%20be%20able%20to%20export%20the%20private%20key%20in%20any%20way.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22PolicyConfiguration.png%22%20style%3D%22width%3A%20403px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196206i1D43B694BFE71E8F%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22PolicyConfiguration.png%22%20alt%3D%22PolicyConfiguration.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAt%20the%20end%20of%20the%20process%2C%20press%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECreate%3C%2FSTRONG%3E%3CSPAN%3E.%20The%20certificate%20will%20be%20displayed%20initially%20in%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EIn%20progress%2C%20failed%20or%20cancelled%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bsection%20but%2C%20if%20you%20refresh%20after%20a%20few%20seconds%2C%20you%20will%20see%20it%20appearing%20in%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECompleted%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bsection.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22CertificateCreated.png%22%20style%3D%22width%3A%20887px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196152i28D02D03849B3772%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22CertificateCreated.png%22%20alt%3D%22CertificateCreated.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIf%2C%20instead%2C%20you%20already%20have%20a%20certificate%20you%20want%20to%20use%2C%20you'll%20just%20need%20to%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EImport%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ein%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EMethod%20of%20Certificate%20creation%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Edropdown%20when%20you%20start%20the%20process%20to%20generate%20or%20import%20a%20certificate.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ImportCertificate.png%22%20style%3D%22width%3A%20642px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196155i9EE3501C90338949%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22ImportCertificate.png%22%20alt%3D%22ImportCertificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIn%20this%20case%20the%20procedure%20will%20be%20simpler%2C%20since%20you'll%20just%20need%20to%20assign%20a%20name%20to%20the%20certificate%2C%20browse%20your%20computer%20to%20find%20the%20right%20PFX%20file%20and%20provide%20the%20password.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH3%20id%3D%22register-a-new-application%22%20id%3D%22toc-hId-1850446763%22%20id%3D%22toc-hId-1850446763%22%3ERegister%20a%20new%20Azure%20application%3C%2FH3%3E%0A%3CP%3EIn%20order%20to%20access%20to%20our%20Key%20Vault%2C%20we%20need%20a%20way%20to%20connect%20to%20it%20through%20protected%20credentials.%20The%20way%20to%20do%20that%20is%20by%20registering%20a%20new%20application%20in%20Azure%2C%20which%20will%20have%20access%20to%20our%20certificate.%20Then%2C%20the%20Azure%20Sign%20Tool%20utility%20will%20connect%20to%20the%20Key%20Vault%20through%20the%20credentials%20associated%20to%20our%20application.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet's%20start%20the%20process.%20Go%20back%20to%20the%20home%20page%20of%20your%20Azure%20portal%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAzure%20Active%20Directory%3C%2FSTRONG%3E%2C%20then%20move%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApp%20registrations%3C%2FSTRONG%3E.%20Click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENew%20registration%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20start%20the%20process.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NewRegistration.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196156iBEE9B9B3A29813AD%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22NewRegistration.png%22%20alt%3D%22NewRegistration.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EGive%20a%20name%20to%20your%20application%2C%20then%20leave%20the%20default%20settings.%20We%20aren't%20going%20to%20use%20this%20application%20to%20enable%20the%20Microsoft%20Identity%20platform%2C%20so%20we%20can%20use%20the%20standard%20configuration.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22RegisterAnApplication.png%22%20style%3D%22width%3A%20824px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196157i48808A260675C83C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22RegisterAnApplication.png%22%20alt%3D%22RegisterAnApplication.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20next%20step%20is%20to%20treat%20the%20application%20as%20a%20public%20client%2C%20since%20we%20are%20in%20a%20scenario%20where%20a%20redirect%20URI%20is%20not%20used%20(again%2C%20we%20aren't%20using%20this%20registration%20to%20enable%20authentication%20in%20an%20web%20or%20desktop%20application%20to%20leverage%20features%20like%20SSO%20or%20Microsoft%20Graph).%20Move%20to%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAuthentication%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bsection%20and%2C%20under%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdvanced%20settings%3C%2FSTRONG%3E%3CSPAN%3E%2C%20move%20the%20switch%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETreat%20application%20as%20a%20public%20client%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bto%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EYes%3C%2FSTRONG%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AdvancedSettings.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196158iC103BEA744A48801%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AdvancedSettings.png%22%20alt%3D%22AdvancedSettings.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EThe%20last%20step%20is%20to%20create%20a%20client%20secret%2C%20which%20is%20the%20password%20we'll%20need%20to%20authenticate%20from%20the%20Azure%20SignTool.%20Move%20to%20the%26nbsp%3B%3CSTRONG%3ECertificates%20%26amp%3B%20secrets%3C%2FSTRONG%3E%26nbsp%3Bsection%2C%20then%20click%20on%26nbsp%3B%3CSTRONG%3ENew%20client%20secret%3C%2FSTRONG%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AddAClientSecret.png%22%20style%3D%22width%3A%20913px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196159i8284BD3A163F65F9%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AddAClientSecret.png%22%20alt%3D%22AddAClientSecret.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20pressed%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ebutton%2C%20you%20will%20be%20redirected%20back%20to%20the%20main%20page%2C%20where%20the%20secret%20will%20be%20listed%20together%20with%20its%20value.%20Make%20sure%20to%20copy%20it%20and%20to%20store%20it%20somewhere%20safe.%20You%20won't%20be%20able%20to%20retrieve%20it%20again.%20As%20soon%20as%20you%20refresh%20the%20page%2C%20the%20secret%20will%20be%20masked%20and%20there%20won't%20be%20any%20way%20to%20reveal%20it.%20You%20will%20be%20forced%20to%20generate%20a%20new%20secret.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThere's%20one%20last%20information%20we%20need%20to%20store%20together%20with%20the%20client%20secret%3A%20the%20application%20identifier.%20Go%20back%20to%20the%20home%20of%20the%20application%20(by%20clicking%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EOverview%3C%2FSTRONG%3E)%20and%2C%20in%20the%20upper%20section%2C%20look%20for%20the%20value%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EApplication%20(client)%20ID%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ApplicationId.png%22%20style%3D%22width%3A%20692px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196160iC3D6655AA2B97CB0%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22ApplicationId.png%22%20alt%3D%22ApplicationId.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EMake%20a%20note%20of%20it%2C%20since%20we're%20going%20to%20need%20it%20later.%20That's%20it%20for%20the%20app%20configuration.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22enable-access-to-key-vault%22%20id%3D%22toc-hId-42992300%22%20id%3D%22toc-hId-42992300%22%3EEnable%20access%20to%20Key%20Vault%3C%2FH3%3E%0A%3CP%3ENow%20go%20back%20to%20the%20Key%20Vault%20you%20have%20previously%20created%20and%20move%20to%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAccess%20policies%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection.%20This%20is%20the%20place%20where%20we%20can%20enable%20our%20new%20application%20to%20access%20to%20the%20information%20stored%20in%20the%20Key%20Vault.%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AccessPolicies.png%22%20style%3D%22width%3A%20867px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196161iD01FAA9CA899B61D%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AccessPolicies.png%22%20alt%3D%22AccessPolicies.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EClick%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%20Access%20Policy%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eto%20start%20the%20wizard%20to%20setup%20the%20access.%20The%20tool%20supports%20choosing%20one%20of%20the%20available%20templates%20to%20define%20the%20permissions%20we%20want%20to%20grant%20but%2C%20in%20our%20scenario%2C%20no%20one%20of%20them%20is%20a%20good%20fit.%20We%20can%20manually%20set%20the%20right%20permission%20using%20the%20other%20dropdowns.%20Specifically%2C%20for%20our%20scenario%20we%20need%20to%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EUnder%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EKey%20permissions%3C%2FSTRONG%3E%2C%20enable%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESign%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoption.%3C%2FLI%3E%0A%3CLI%3EUnder%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECertificate%20permissions%3C%2FSTRONG%3E%2C%20enable%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EGet%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoption.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EThese%20permissions%20are%20enough%20for%20Azure%20SignTool%3A%20the%20second%20one%20will%20enable%20it%20to%20download%20the%20certificate%2C%20the%20first%20one%20to%20use%20it%20for%20signing%20the%20MSIX%20package.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20last%20important%20step%20is%20to%20specify%20which%20application%20is%20going%20to%20access%20to%20this%20policy.%20Click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESelect%20principal%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%2C%20using%20the%20internal%20search%2C%20look%20for%20the%20Azure%20application%20you%20have%20created%20in%20the%20previous%20step.%20In%20my%20case%2C%20for%20example%2C%20it's%20called%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESignToolForContoso%3C%2FSTRONG%3E%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22SignToolForContoso.png%22%20style%3D%22width%3A%20304px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196162i3B0718D4645D4DB2%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22SignToolForContoso.png%22%20alt%3D%22SignToolForContoso.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EOnce%20you%20have%20found%20it%2C%20click%20on%20it%20and%20then%20press%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESelect%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eat%20the%20end%20of%20the%20blade.%3C%2FP%3E%0A%3CP%3EThis%20is%20how%20the%20policy%20should%20look%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22AddAccessPolicy.png%22%20style%3D%22width%3A%20502px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196163i047268F0FF139CD1%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22AddAccessPolicy.png%22%20alt%3D%22AddAccessPolicy.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EPress%26nbsp%3B%3CSTRONG%3EAdd%3C%2FSTRONG%3E%26nbsp%3Band%2C%20when%20you're%20back%20to%20the%20main%20Access%20policies%20page%2C%20hit%26nbsp%3B%3CSTRONG%3ESave%3C%2FSTRONG%3E.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22sign-the-msix-package%22%20id%3D%22toc-hId--1764462163%22%20id%3D%22toc-hId--1764462163%22%3ESign%20the%20MSIX%20package%3C%2FH3%3E%0A%3CP%3EWe%20have%20completed%20the%20configuration%20on%20the%20Azure%20side.%20Now%20we%20can%20start%20the%20process%20of%20signing%20the%20MSIX%20package.%20As%20first%20step%2C%20we%20need%20to%20acquire%20the%20Azure%20SignTool%20utility.%20Azure%20SignTool%20works%20like%20the%20signtool%20included%20in%20the%20Windows%2010%20SDK%2C%20with%20the%20difference%20that%20instead%20of%20using%20a%20local%20certificate%2C%20it%20can%20leverage%20the%20ones%20we%20have%20stored%20in%20Azure%20Key%20Vault.%3C%2FP%3E%0A%3CP%3EThe%20easiest%20way%20to%20acquire%20it%20is%20through%20the%20.NET%20Core%20CLI%2C%20since%20it's%20available%20as%20a%20.NET%20Core%20Global%20Tool.%20Make%20sure%20to%20have%20the%20latest%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-.NET%20Core%20SDK%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Einstalled%20on%20your%20machine%2C%20then%20open%20a%20terminal%20and%20run%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-powershell%20hljs%22%3Edotnet%20tool%20install%20--global%20AzureSignTool%20--version%20%3CSPAN%20class%3D%22hljs-number%22%3E2.0%3C%2FSPAN%3E.%3CSPAN%20class%3D%22hljs-number%22%3E17%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EOnce%20the%20operation%20has%20been%20completed%2C%20you%20will%20be%20able%20to%20run%20the%20command%20simply%20by%20typing%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EAzureSignTool%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efrom%20any%20location.%20Now%20you%20will%20be%20able%20to%20sign%20your%20MSIX%20packages%20by%20running%20the%20following%20command%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-powershell%20hljs%22%3EAzureSignTool%20sign%20-kvu%20%3CSPAN%20class%3D%22hljs-string%22%3E%22https%3A%2F%2Fcontosoexpenses-blog.vault.azure.net%2F%22%3C%2FSPAN%3E%20-kvi%20%3CSPAN%20class%3D%22hljs-string%22%3E%2264fae35e-cb84-4b9f-86eb-5170d169316d%22%3C%2FSPAN%3E%20-kvs%20%3CSPAN%20class%3D%22hljs-string%22%3E%22this-is-the-secret%22%3C%2FSPAN%3E%20-kvc%20%3CSPAN%20class%3D%22hljs-string%22%3E%22AppConsult%22%3C%2FSPAN%3E%20-tr%20http%3A%2F%2Ftimestamp.digicert.com%20-v%20.%5CMyContosoApp.Package_1.%3CSPAN%20class%3D%22hljs-number%22%3E0.1%3C%2FSPAN%3E.%3CSPAN%20class%3D%22hljs-number%22%3E0%3C%2FSPAN%3E_x86.msix%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ELet's%20see%20in%20details%20all%20the%20parameters%20we%20have%20configured%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Ekvu%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20URL%20of%20your%20Key%20Vault.%20You%20can%20find%20it%20in%20the%20main%20page%20of%20the%20service%20in%20the%20Azure%20portal%2C%20under%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDNS%20Name%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22DNSName.png%22%20style%3D%22width%3A%20849px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196164i40F054A49082364C%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22DNSName.png%22%20alt%3D%22DNSName.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Ekvi%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20application%20id%20of%20the%20Azure%20app%20we%20have%20previously%20registered.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Ekvs%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20client%20secret%20we%20have%20previously%20generated.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Ekvc%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20friendly%20name%20of%20our%20certificate%20that%20we%20have%20chosen%20during%20the%20creation%20%2F%20import%20process.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Etr%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20URL%20of%20a%20timestamp%20server.%20By%20using%20this%20option%2C%20we%20can%20enable%20our%20signing%20to%20work%20even%20after%20the%20certificate%20has%20expired.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3E%3CCODE%3Ev%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20path%20of%20the%20MSIX%20package%20we%20want%20to%20sign.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3EThat's%20it.%20If%20we%20did%20everything%20correct%2C%20this%20is%20the%20output%20we%20should%20see%20in%20the%20terminal%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Terminal.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196165iC592ADA11FF55974%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Terminal.png%22%20alt%3D%22Terminal.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EPlease%20note!%26nbsp%3B%3C%2FSTRONG%3EBe%20aware%20that%20future%20releases%20of%20Azure%20SignTool%20will%20require%20also%20a%20new%20parameter%20to%20do%20the%20signing%3A%20%3CSTRONG%3E-kvt%3C%2FSTRONG%3E%2C%20which%20is%20the%26nbsp%3B%3CSTRONG%3EDirectory%20(tenant)%20ID%26nbsp%3B%3C%2FSTRONG%3Ethat%20you%20can%20find%20in%20the%20Azure%20App%20registration%20page.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22TenantId.png%22%20style%3D%22width%3A%20774px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196407iC3E304BD64A75603%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22TenantId.png%22%20alt%3D%22TenantId.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EThis%20is%20a%20new%20requirement%20enforced%20by%20the%20most%20recent%20versions%20of%20the%20Azure%20SDK%20leveraged%20by%20the%20tool.%20The%20current%20version%20is%20still%20using%20the%20old%20one%20so%2C%20until%20the%20new%20version%20will%20be%20out%2C%20the%26nbsp%3B%3CSTRONG%3E-kt%3C%2FSTRONG%3E%20parameter%20won't%20be%20needed%20(actually%20it%20will%20break%20the%20tool%2C%20because%20the%20current%20version%20doesn't%20recognize%20it%20as%20a%20valid%20parameter).%3C%2FP%3E%0A%3CH3%20id%3D%22what-if-something-goes-wrong%22%20id%3D%22toc-hId-723050670%22%20id%3D%22toc-hId-723050670%22%3EWhat%20if%20something%20goes%20wrong%3F%3C%2FH3%3E%0A%3CP%3EThere%20are%20two%20main%20reasons%20that%20could%20lead%20the%20Azure%20SignTool%20to%20fail%3A%3C%2FP%3E%0A%3COL%3E%0A%3COL%3E%0A%3CLI%3E%0A%3CP%3EYou%20didn't%20follow%20all%20the%20steps%20in%20the%20right%20way.%20It's%20enough%20to%20miss%20one%20of%20the%20steps%20(like%20forgetting%20to%20set%20the%20Azure%20app%20as%20public%20client%20or%20missing%20one%20of%20the%20permissions%20to%20the%20access%20policy)%20to%20move%20to%20an%20unsupported%20state.%3C%2FP%3E%0A%3C%2FLI%3E%0A%3CLI%3E%0A%3CP%3EYou%20didn't%20set%20the%20Publisher%20in%20the%20manifest%20of%20your%20MSIX%20package%20with%20the%20same%20subject%20you%20have%20selected%20for%20the%20certificate.%20For%20example%2C%20in%20my%20case%20I%20have%20created%20the%20certificate%20with%20subject%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ECN%3DAppConsult%3C%2FSTRONG%3E%2C%20so%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3EIdentity%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20of%20my%20manifest%20looks%20like%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-xml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-tag%22%3E%26lt%3B%3CSPAN%20class%3D%22hljs-name%22%3EIdentity%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EName%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22MyContosoApp%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EPublisher%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22CN%3DAppConsult%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EVersion%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%221.0.1.0%22%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-attr%22%3EProcessorArchitecture%3C%2FSPAN%3E%3D%3CSPAN%20class%3D%22hljs-string%22%3E%22x86%22%3C%2FSPAN%3E%20%2F%26gt%3B%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3C%2FOL%3E%0A%3CH3%20id%3D%22installing-the-application%22%20id%3D%22toc-hId--1084403793%22%20id%3D%22toc-hId--1084403793%22%3EInstalling%20the%20application%3C%2FH3%3E%0A%3CP%3EIf%20you%20did%20everything%20correctly%2C%20when%20you%20double%20click%20on%20the%20MSIX%20package%20Windows%20will%20list%20it%20as%20a%20trusted%20package%20and%20you%20will%20be%20able%20to%20go%20on%20and%20install%20it%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22TrustedPublisher.png%22%20style%3D%22width%3A%20650px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196166i7217DA0C2E9F14F6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22TrustedPublisher.png%22%20alt%3D%22TrustedPublisher.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EIf%20you%20see%2C%20instead%2C%20an%20error%20like%20the%20one%20below%2C%20it's%20simply%20because%20the%20certificate%20is%20not%20trusted.%20Remember%20that%2C%20if%20you're%20using%20a%20self-signed%20certificate%20like%20I%20did%20so%20far%2C%20it%20isn't%20automatically%20trusted%20by%20Windows.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22NotTrusted.png%22%20style%3D%22width%3A%20650px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196167iD2172230E1D27D1B%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22NotTrusted.png%22%20alt%3D%22NotTrusted.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20such%2C%20you%20will%20need%20to%20right%20click%20on%20the%20MSIX%20package%20in%20File%20Explorer%2C%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EProperties%3C%2FSTRONG%3E%3CSPAN%3E%2C%20choose%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDigital%20Signatures%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%2C%20from%20there%2C%20start%20the%20process%20to%20install%20the%20certificate%20in%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ETrusted%20People%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bstore.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22using-azure-key-vault-as-part-of-your-cicd-pipeline%22%20id%3D%22toc-hId-1403109040%22%20id%3D%22toc-hId-1403109040%22%3EUsing%20Azure%20Key%20Vault%20as%20part%20of%20your%20CI%2FCD%20pipeline%3C%2FH3%3E%0A%3CP%3ESo%20far%20we%20have%20seen%20how%20to%20manually%20use%20the%20Azure%20SignTool%20utility.%20However%2C%20the%20scenario%20in%20which%20can%20be%20really%20helpful%20is%20in%20a%20CI%2FCD%20pipeline%2C%20where%20we%20need%20to%20automate%20the%20signing%20operation%20but%2C%20at%20the%20same%20time%2C%20protect%20the%20certificate.%20Regardless%20if%20we%20have%20built%20our%20CI%2FCD%20pipeline%20in%20Azure%20DevOps%20or%20GitHub%2C%20the%20fundamentals%20of%20the%20operations%20are%20the%20same%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EWe%20need%20to%20install%20the%20Azure%20SignTool%20on%20the%20hosted%20agent%3C%2FLI%3E%0A%3CLI%3EWe%20need%20to%20run%20a%20script%20to%20sign%20the%20package%20using%20the%20same%20command%20we%20have%20just%20used%20manually%20from%20the%20terminal%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3EThe%20only%20difference%2C%20based%20on%20the%20platform%20you're%20using%2C%20is%20the%20way%20you're%20going%20to%20use%20to%20protect%20the%20sensitive%20information%20required%20by%20the%20tool%2C%20like%20the%20application%20id%20and%20the%20client%20secret.%20We%20can't%20expose%20them%20publicly%20in%20the%20pipeline%2C%20otherwise%20we%20are%20back%20to%20square%20one.%20Let's%20see%20how%20to%20leverage%20Azure%20Key%20Vault%20in%20two%20common%20platforms%3A%20Azure%20DevOps%20and%20GitHub%20Actions.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22using-azure-key-vault-in-azure-devops%22%20id%3D%22toc-hId--404345423%22%20id%3D%22toc-hId--404345423%22%3EUsing%20Azure%20Key%20Vault%20in%20Azure%20DevOps%3C%2FH3%3E%0A%3CP%3EIf%20you%20don't%20already%20have%20a%20CI%2FCD%20pipeline%20for%20a%20desktop%20app%20on%20Azure%20DevOps%2C%20you%20can%20learn%20how%20to%20create%20one%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-in%20the%20official%20documentation%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eor%20in%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-the%20last%20chapter%20of%20my%20free%20e-book.%3C%2FP%3E%0A%3CP%3EWhen%20I%20use%20this%20platform%2C%20I%20prefer%20to%20leverage%20a%20Release%20pipeline%20to%20take%20care%20of%20the%20signing%20and%20deployment%20of%20the%20MSIX%20package.%20This%20way%2C%20I%20can%20define%20multiple%20deployment%20stages.%20For%20example%2C%20this%20is%20how%20my%20Release%20pipeline%20looks%20like%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22ReleasePipeline.png%22%20style%3D%22width%3A%20969px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196168i5A84DE53411C0A78%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22ReleasePipeline.png%22%20alt%3D%22ReleasePipeline.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EI%20have%20two%20stages%3A%20one%20for%20deployment%20in%20a%20testing%20environment%20and%20one%20in%20production%20environment.%20The%20deployment%20to%20the%20testing%20environment%20kicks%20in%20automatically%20whenever%20there's%20a%20new%20MSIX%20package%20(which%20is%20produced%2C%20instead%2C%20by%20a%20regular%20pipeline).%20Let's%20see%20how%20one%20of%20my%20stages%20look%20like%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22pipeline.png%22%20style%3D%22width%3A%20516px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196169iB032506A0AA749CF%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22pipeline.png%22%20alt%3D%22pipeline.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIn%20this%20pipeline%20you%20can%20see%20the%20two%20actions%20we%20need%20to%20perform%3A%20install%20Azure%20SignTool%20and%20sign%20the%20package%20with%20it.%20Let's%20configure%20it.%20As%20first%20step%2C%20we%20need%20to%20use%20the%20Variables%20feature%20provided%20by%20Azure%20DevOps%20to%20safely%20store%20the%20credentials%20to%20access%20to%20Key%20Vault.%20Click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EVariables%3C%2FSTRONG%3E%2C%20make%20sure%20you%20are%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EPipeline%20variables%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Esection%20and%20then%20add%20a%20new%20variable%20for%20each%20sensitive%20information%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20Azure%20Key%20Vault%20URL%3C%2FLI%3E%0A%3CLI%3EThe%20Azure%20Key%20Vault%20name%3C%2FLI%3E%0A%3CLI%3EThe%20application%20identifier%3C%2FLI%3E%0A%3CLI%3EThe%20client%20secret%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EAfter%20you%20have%20created%20them%2C%20make%20sure%20to%20click%20on%20the%20lock%20icon%20near%20each%20variable.%20This%20option%20will%20protect%20them%2C%20making%20sure%20that%20no%20one%20else%20(including%20yourself)%20will%20be%20able%20to%20see%20the%20value.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Variables.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196170i9845A52F8C3E34E6%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Variables.png%22%20alt%3D%22Variables.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EAs%20second%20step%2C%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAgent%20job%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%20make%20sure%20it's%20running%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ewindows-2019%3C%2FSTRONG%3E%3CSPAN%3E.%20Azure%20SignTool%20is%20a%20.NET%20Core%20Global%20Tool%2C%20but%20it%20leverages%20specific%20Windows%20APIs%20to%20perform%20the%20signing.%20Then%20let's%20add%20the%20first%20task%2C%20by%20clicking%20on%20the%20%2B%20sign%20near%20the%20Agent%20job.%20Look%20for%20the%20task%20called%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E.NET%20Core%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Band%20click%20on%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EAdd%3C%2FSTRONG%3E%3CSPAN%3E%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22netcoretask.png%22%20style%3D%22width%3A%20463px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196171iCED718331530EC96%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22netcoretask.png%22%20alt%3D%22netcoretask.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20let's%20configure%20the%20task%20to%20install%20Azure%20SignTool%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EDisplay%20name%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ewill%20be%20used%20as%20a%20label%20for%20the%20step%2C%20so%20choose%20the%20name%20you%20prefer%20(in%20my%20case%2C%20I%20used%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInstall%20Azure%20SignTool%3C%2FSTRONG%3E).%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECommand%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20.NET%20Core%20command%20we%20want%20to%20perform.%20Choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Ecustom%3C%2FSTRONG%3E%2C%20since%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etool%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eisn't%20available%20in%20the%20dropdown.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3ECustom%20command%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20the%20.NET%20CLI%20command%20we%20want%20to%20run.%20Set%20it%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Etool%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EArguments%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eis%20where%20we%20define%20all%20command%20parameters.%20Set%20it%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Einstall%20--global%20AzureSignTool%20--version%202.0.17%3C%2FSTRONG%3E.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22InstallAzureSignTool.png%22%20style%3D%22width%3A%20438px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196172iF3EF0F8965DEBF25%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22InstallAzureSignTool.png%22%20alt%3D%22InstallAzureSignTool.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EIn%20case%20you're%20using%20a%20multi-stage%20deployment%20pipeline%20based%20on%20YAML%20instead%20of%20a%20traditional%20release%20pipeline%2C%20this%20is%20the%20equivalent%20YAML%20of%20the%20task%20we%20have%20just%20created%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20task%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EDotNetCoreCLI%402%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Install%20Azure%20SignTool'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20inputs%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20command%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Ecustom%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20custom%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Etool%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20%20%20arguments%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'install%20--global%20AzureSignTool%20--version%202.0.17'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThe%20next%20step%20is%20to%20sign%20the%20package.%20Click%20again%20on%20%2B%20near%20Agent%20job%20and%2C%20this%20time%2C%20add%20a%20PowerShell%20task.%20Give%20it%20a%20name%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EDisplay%20name%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%20and%2C%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EType%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoption%2C%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EInline%3C%2FSTRONG%3E.%20Then%20copy%20and%20paste%20the%20following%20command%20in%20the%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3EScript%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Efield%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-powershell%20hljs%22%3E%26amp%3B%20AzureSignTool%20sign%20-kvu%20%24(AzureKeyVaultUrl)%20-kvi%20%24(ClientId)%20-kvs%20%24(ClientPassword)%20-kvc%20%24(AzureKeyVaultName)-tr%20http%3A%2F%2Ftimestamp.digicert.com%20-v%20%3CSPAN%20class%3D%22hljs-string%22%3E%22%24(System.DefaultWorkingDirectory)%5C_ContosoExpenses-Basic%5CCD%5CContosoExpenses.Package_%24(Build.BuildNumber).0_Test%5CContosoExpenses.Package_%24(Build.BuildNumber).0_x86.msixbundle%22%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EWe're%20launching%20the%20same%20exact%20command%20we%20have%20previously%20manually%20launched%20on%20our%20computer.%20The%20only%20difference%20is%20that%20the%20various%20parameters%20which%20contains%20sensitive%20information%20are%20set%20using%20the%20variables%20we%20have%20previously%20defined%2C%20by%20leveraging%20the%20Azure%20DevOps%20syntax%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24(variable-name)%3C%2FCODE%3E.%20The%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E-v%3C%2FCODE%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eparameter%20is%20the%20only%20one%20you%20will%20have%20to%20change%2C%20since%20it%20must%20point%20to%20the%20path%20of%20your%20MSIX%20file%20in%20your%20artifacts%20folder.%3C%2FP%3E%0A%3CP%3EThis%20is%20the%20equivalent%20YAML%20for%20a%20multi-stage%20pipeline%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3Esteps%3A%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E-%20powershell%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'%26amp%3B%20AzureSignTool%20sign%20-kvu%20%24(AzureKeyVaultUrl)%20-kvi%20%24(ClientId)%20-kvs%20%24(ClientPassword)%20-kvc%20%24(AzureKeyVaultName)-tr%20http%3A%2F%2Ftimestamp.digicert.com%20-v%20%22%24(System.DefaultWorkingDirectory)%5C_ContosoExpenses-Basic%5CCD%5CContosoExpenses.Package_%24(Build.BuildNumber).0_Test%5CContosoExpenses.Package_%24(Build.BuildNumber).0_x86.msixbundle%22'%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20displayName%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E'Sign%20the%20package'%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EThat's%20it.%20Now%20that%20you%20have%20a%20signed%20MSIX%20package%2C%20you%20can%20add%20another%20task%20to%20take%20care%20of%20the%20deployment%2C%20based%20on%20your%20infrastructure.%20In%20my%20case%2C%20for%20example%2C%20I'm%20copying%20the%20file%20on%20a%20blob%20storage%20on%20Azure.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22using-azure-keyvault-with-github-actions%22%20id%3D%22toc-hId-2083167410%22%20id%3D%22toc-hId-2083167410%22%3EUsing%20Azure%20KeyVault%20with%20GitHub%20Actions%3C%2FH3%3E%0A%3CP%3EGitHub%20Actions%20is%20gaining%20lot%20of%20popularity%20and%20the%20.NET%20team%20has%20done%20a%20great%20job%20to%20support%20Windows%20developers%20who%20want%20to%20use%20it%20to%20build%20and%20deploy%20their%20desktop%20applications.%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-Edward%20Skrod%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ehas%20prepared%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-a%20detailed%20step-by-step%20guide%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20also%20helped%20to%20put%20together%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-a%20workflow%20template%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ethat%20you%20can%20use%20as%20a%20starting%20point.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECompared%20to%20Azure%20DevOps%2C%20currently%20GitHub%20doesn't%20support%20a%20Release%20management%20story%2C%20but%20you%20can%20create%20multi-stage%20pipelines%20which%20performs%20the%20tasks%20in%20different%20stages.%20For%20example%2C%20you%20can%20have%20a%20single%20YAML%20file%20which%20describes%20both%20a%20build%20and%20a%20deployment%20task.%20Let's%20see%20how%20to%20add%20to%20our%20workflow%20the%20tasks%20we%20need%20to%20install%20and%20use%20Azure%20SignTool.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EAs%20first%20step%2C%20like%20we%20did%20on%20Azure%20DevOps%2C%20we%20need%20to%20safely%20store%20the%20credentials.%20GitHub%20calls%20them%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3Esecrets%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%20they%20can%20be%20added%20in%20the%20settings%20of%20your%20repository.%20Once%20you're%20on%20your%20GitHub%20repository%2C%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESettings%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Ethen%20move%20to%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESecrets%3C%2FSTRONG%3E.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Secrets.png%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196173i990E6EE7D339A672%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22Secrets.png%22%20alt%3D%22Secrets.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFrom%20here%2C%20you%20just%20need%20to%20click%20on%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ENew%20secret%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eand%2C%20like%20you%20did%20with%20Azure%20DevOps%2C%20add%20a%20new%20secret%20for%20each%20protected%20information%3A%20the%20Key%20Vault%20URL%2C%20the%20Key%20Vault%20name%2C%20the%20application%20id%20and%20the%20client%20secret.%20The%20only%20difference%20is%20that%20we%20won't%20have%20to%20take%20any%20extra%20step%20to%20protect%20them%20since%20secrets%20are%20already%20stored%20in%20a%20safe%20way.%20You'll%20be%20able%20only%20to%20update%20or%20remove%20a%20secret%2C%20no%20one%20will%20see%20its%20content.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ENow%20you%20can%20move%20to%20your%20workflow%20and%20add%20the%20tasks%20we%20need%20to%20do%20the%20signing.%20You%20will%20have%20to%20add%20them%20after%20that%20the%20MSIX%20package%20has%20been%20generated%20so%2C%20ideally%2C%20after%20the%20Build%20task.%3C%2FP%3E%0A%3CP%3ELet's%20start%20from%20the%20task%20to%20install%20Azure%20SignTool%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20name%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EInstall%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAzureSignTool%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20run%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Edotnet%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Etool%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Einstall%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E--global%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3EAzureSignTool%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-bullet%22%3E--version%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-number%22%3E2.0%3C%2FSPAN%3E%3CSPAN%20class%3D%22hljs-number%22%3E.17%3C%2FSPAN%3E%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3ENothing%20special%2C%20it's%20just%20a%20script%20task%20which%20will%20execute%20the%20same%20command%20we%20have%20used%20before%20to%20install%20Azure%20SignTool%20on%20our%20PC.%20Let's%20move%20now%20to%20the%20singing%20task%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%3E%3CCODE%20class%3D%22language-yaml%20hljs%22%3E%3CSPAN%20class%3D%22hljs-attr%22%3E-%20name%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3ESign%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3Epackage%3C%2FSPAN%3E%0A%3CSPAN%20class%3D%22hljs-attr%22%3E%20%20run%3A%3C%2FSPAN%3E%20%3CSPAN%20class%3D%22hljs-string%22%3E%7C%0A%20%20%20%20%20%20%20%20Get-ChildItem%20-recurse%20-Include%20*.msix%20%7C%20ForEach-Object%20%7B%0A%20%20%20%20%20%20%20%20%24msixPath%20%3D%20%24_.FullName%0A%20%20%20%20%20%20%20%20%26amp%3B%20AzureSignTool%20sign%20-kvu%20%22%24%3CSPAN%20class%3D%22hljs-template-variable%22%3E%7B%7B%20secrets.AzureClientUrl%20%7D%7D%3C%2FSPAN%3E%22%20-kvi%20%22%24%3CSPAN%20class%3D%22hljs-template-variable%22%3E%7B%7B%20secrets.AzureClientId%20%7D%7D%3C%2FSPAN%3E%22%20-kvs%20%22%24%3CSPAN%20class%3D%22hljs-template-variable%22%3E%7B%7B%20secrets.AzureClientSecret%20%7D%7D%3C%2FSPAN%3E%22%20-kvc%20%24%3CSPAN%20class%3D%22hljs-template-variable%22%3E%7B%7B%20secrets.AzureClientName%20%7D%7D%3C%2FSPAN%3E%20-tr%20http%3A%2F%2Ftimestamp.digicert.com%20-v%20%24msixPath%0A%20%20%20%20%20%20%20%20%7D%0A%3C%2FSPAN%3E%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIn%20this%20case%2C%20there%20are%20a%20few%20differences%20compared%20to%20the%20Azure%20DevOps%20one.%20The%20first%20obvious%20one%20is%20that%20GitHub%20uses%20a%20different%20syntax%20to%20access%20to%20the%20secrets%2C%20which%20is%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CCODE%3E%24%7B%7B%20secrets.SECRET_NAME%20%7D%7D%3C%2FCODE%3E.%20As%20such%2C%20the%20various%20parameters%20are%20filled%20with%20the%20values%20we%20have%20previously%20created%20in%20the%20Secrets%20section.%20The%20other%20one%20is%20that%20I'm%20using%20a%20slightly%20different%20approach%20to%20find%20the%20MSIX%20packages%20to%20sign.%20I'm%20using%20a%20PowerShell%20script%20which%20iterates%20through%20all%20the%20files%20stored%20in%20the%20build%20output%20and%2C%20only%20if%20they%20have%20the%20.msix%20extension%2C%20then%20I%20go%20on%20and%20use%20the%20Azure%20SignTool%20utility%20on%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThat's%20it.%20Now%20you%20can%20add%20additional%20tasks%20to%20the%20pipeline%20to%20take%20care%20of%20the%20deployment%20of%20the%20signed%20MSIX%20package%20on%20a%20website%2C%20on%20the%20Microsoft%20Store%20or%20any%20other%20supported%20approach.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH3%20id%3D%22signing-with-visual-studio%22%20id%3D%22toc-hId--419450532%22%20id%3D%22toc-hId--419450532%22%3ESigning%20with%20Visual%20Studio%3C%2FH3%3E%0A%3CP%3EAs%20a%20last%20%22bonus%20information%22%2C%20Visual%20Studio%2016.6%20has%20recently%20added%20support%20for%20Azure%20Key%20Vault%20when%20you%20generate%20MSIX%20packages.%20This%20could%20be%20a%20great%20alternative%20to%20Azure%20SignTool%20if%20you're%20generating%20MSIX%20packages%20locally%20using%20the-ERR%3AREF-NOT-FOUND-%20Windows%20Application%20Packaging%20Project.%20To%20enable%20this%20option%20you%20just%20have%20to%20right%20click%20on%20the%20Windows%20Application%20Packaging%20Project%20included%20in%20your%20solution%20and%20choose%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3E%3CSTRONG%3EPublish%20%E2%86%92%20Create%20app%20packages%3C%2FSTRONG%3E%3C%2FSTRONG%3E.%20After%20you%20have%20chosen%20the%20path%20to%20create%20a%20package%20for%20sideloading%20(apps%20published%20on%20the%20Microsoft%20Store%20don't%20need%20to%20be%20signed%2C%20since%20the%20Store%20submission%20process%20will%20take%20care%20of%20that)%2C%20you%20will%20see%20a%20new%20option%20in%20the%20list%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VisualStudioAzureKeyVault.png%22%20style%3D%22width%3A%20786px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196192i89B1327FD8827BEE%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22VisualStudioAzureKeyVault.png%22%20alt%3D%22VisualStudioAzureKeyVault.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3EBy%20pressing%20the%26nbsp%3B%3C%2FSPAN%3E%3CSTRONG%3ESelect%20From%20Azure%20Key%20Vault%3C%2FSTRONG%3E%3CSPAN%3E%26nbsp%3Bbutton%20you%20will%20have%20the%20opportunity%20to%20login%20with%20your%20Azure%20account%2C%20specify%20the%20URL%20of%20your%20Azure%20Key%20Vault%20and%20select%20one%20of%20the%20available%20certificates%2C%20as%20you%20can%20see%20from%20the%20image%20below%3A%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22VisualStudioPickCertificate.png%22%20style%3D%22width%3A%20775px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F196193iC70B7180F081F717%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20title%3D%22VisualStudioPickCertificate.png%22%20alt%3D%22VisualStudioPickCertificate.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHowever%2C%20I%20would%20recommend%20using%20this%20feature%20only%20for%20some%20specific%20scenarios%2C%20like%20you%20need%20to%20quickly%20generate%20and%20share%20a%20MSIX%20package%20with%20a%20colleague.%20The%20best%20approach%20to%20generate%20MSIX%20packages%20is%20to%20leverage%20a%20CI%2FCD%20pipeline%20to%20automate%20the%20process%20and%20to%20use%20Azure%20SignTool%20as%20part%20of%20it.%3C%2FP%3E%0A%3CH3%20id%3D%22wrapping-up%22%20id%3D%22toc-hId-2068062301%22%20id%3D%22toc-hId-2068062301%22%3EWrapping%20up%3C%2FH3%3E%0A%3CP%3EHaving%20a%20solid%20signing%20story%20when%20you%20choose%20to%20distribute%20your%20Windows%20desktop%20application%20with%20MSIX%20is%20critical.%20In%20this%20blog%20post%20we%20have%20seen%20how%20we%20can%20use%20Azure%20Key%20Vault%20to%20protect%20our%20code-signing%20certificate%20(and%20even%20generate%20it)%20and%20then%2C%20using%20an%20utility%20called%20Azure%20SignTool%2C%20sign%20the%20MSIX%20package.%20This%20approach%20can%20be%20extremely%20helpful%20when%20you%20enable%20a%20CI%2FCD%20approach%20to%20automatically%20build%20and%20deploy%20your%20MSIX%20packages%2C%20since%20you%20need%20to%20find%20the%20right%20balance%20between%20convenience%20(you%20need%20to%20find%20an%20easy%20to%20way%20to%20sign%20the%20packages%20as%20part%20of%20your%20pipeline)%20and%20security%20(you%20can't%20store%20in%20public%20your%20private%20certificate).%20Azure%20Key%20Vault%20and%20Azure%20SignTool%20are%20a%20great%20combination%20to%20solve%20this%20problem%2C%20since%20they%20give%20you%20the%20opportunity%20to%20sign%20your%20MSIX%20packages%20as%20part%20of%20the%20CI%2FCD%20pipeline%20but%20without%20storing%20it%20in%20the%20repository%20or%20in%20the%20Azure%20DevOps%20%2F%20GitHub%20project.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EYou%20can%20take%20a%20look%20an%20existing%20workflow%20on%20GitHub%20which%20uses%20this%20approach%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E-ERR%3AREF-NOT-FOUND-here.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EBefore%20wrapping%20up%2C%20I%20want%20to%20thank%20-ERR%3AREF-NOT-FOUND-Claire%20Novotny%20who%20helped%20me%20figuring%20out%20a%20couple%20of%20issues%20around%20authentication%20with%20Azure%20Key%20Vault.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EHappy%20packaging!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-1436154%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3ESigning%20is%20one%20of%20the%20most%20critical%20aspects%20when%20working%20with%20MSIX%20packages.%20In%20this%20post%20we're%20going%20to%20see%20how%20we%20can%20achieve%20it%20with%20the%20help%20of%20Azure%20Key%20Vault.%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-TEASER%3E
Microsoft

Signing is one of the most critical aspects when working with MSIX packages. One of the key goals of MSIX as deployment technology is to ensure safety and trust and signing is one of the ways to achieve it. Thanks to signing, we are sure that the application we're about to install is coming from a trusted publisher and not from a potentially malicious developer. Certification authorities (either enterprise or public ones) have a rigorous background check process, which makes sure that when you request a certificate under a name or a brand, you're indeed the person or the company you claim to be.

 

certificate.png

For the same reason, certificates must be stored safely to avoid any identity theft. If we would expose the private key of the certificate on a public repository, for example, other developers could reuse it and sign other applications with our identity.

 

As such, especially when we want to implement a CI/CD pipeline to continuously build and deploy our desktop applications, we need to find the right balance between safety and convenience. We want to make it easy to sign our packages with our certificates as part of the process; at the same time, we must do it without compromising the private key.

 

There are various options to achieve this goal. In this post, we're going to focus on Azure Key Vault, a service provided by Azure which allows to store in a safe way keys, secrets and certificates. Azure Key Vault is a critical service for many scenarios: as developers, for example, we can use it to store the connection strings to our database; or the secrets to connect to a 3rd part service, like a protected API. Thanks to the APIs offered by Azure Key Vault, we can retrieve the protected information at runtime, without having to expose them in the source code or in a configuration file. Among the various features offered by Azure Key Vault, we can use it also to store certificates. We can use it to acquire, generate and renew certificates from a public authority, relieving us from all the troubles of certificates management.

 

In this post we're going to see how we can store on Azure Key Vault a certificate we own and then use it to sign a MSIX package using an open source tool called Azure Sign Tool, developed by Kevin Jones. In the end, we're going to see how we can integrate it in our CI/CD pipeline on Azure DevOps or GitHub.

 

Setup Azure Key Vault

As first step, you must login to the Azure Portal with your Azure credentials. Click on the Create a resource button and, using the internal search, look for Key Vault:

 

KeyVault.png

Click on Create to kick start the provisioning process. There are only a few required settings to setup:

 

  • Name
  • Region
  • Pricing tier: for this post I'm going to use the default one. However, if you really care about security, you should consider the Premium tier, which supports to store secret and keys backed by Hardware Security Modules.
  • Retention period (leave the default value of 90 days)

KeyVaultSetup.png

Once you're done, click Review + create, followed by the Create button to complete the deployment. Once it's completed, go to the resource. We're now ready to import our certificate.

 

Create or import the certificate

Before you start you need to decide which kind of certificate you're going to use. Ideally, you should have acquired it from a certificate authority like DigiCert. These certificates are the best to use for public distribution, since they are automatically trusted by Windows 10. As such, the user won't have to do anything special to install your application. If you don't have one and you aren't willing to buy one for the moment, you can also generate a self-signing certificate directly through the portal. It isn't the ideal solution for publicly distributing an application since these certificates can't validate the identify of the person / company and, as such, they aren't implicitly trusted by Windows. The user will need to manually trust the certificate, which requires administrator rights.

 

However, self-signing certificates are good enough for testing, so let's use this approach. In the Key Vault you have just created move to Certificate and click on Generate/Import.

 

NewCertificate.png

 

Let's start the process to generate a new self-signed certificate. This is the setup screen:

 

CreateCertificate.png

These are the values to configure:

  • Method or Certificate creation: since we're creating a new certificate, leave Generate.
  • Certificate Name: this name identifies your certificate.
  • Type or Certificate Authority (CA): leave self-signed certificate. Eventually, you can change this option to start the process to directly purchase a certificate from a public CA and store it in Key Vault.
  • Subject: this field is very important because it must match the Publisher you're going to use in the manifest of your MSIX package.

Leave all the other settings with the default value. However, there's one last important section to setup: Advanced Policy Configuration. If we click on it, we will have access to various advanced options for the certificate. The most important one is Ektended Key Usage (EKUs), which specifies the various use cases supported by the certificate. As per the documentation, in order to use a certificate to sign a MSIX package we need to enable the following EKUs:

 

  • 1.3.6.1.5.5.7.3.3 indicates that the certificate is valid for code signing.
  • 1.3.6.1.4.1.311.10.3.13 indicates that the certificate respects lifetime signing.

As such, you need to replace the existing values with these two ones, separated by a comma. Another setting that you may want to configure, in order to get better security, is to set the Exportable Private Key to No. This way, even if you store the certificate locally, you won't be able to export the private key in any way.

 

PolicyConfiguration.png

 

At the end of the process, press Create. The certificate will be displayed initially in the In progress, failed or cancelled section but, if you refresh after a few seconds, you will see it appearing in the Completed section.

 

CertificateCreated.png

If, instead, you already have a certificate you want to use, you'll just need to choose Import in the Method of Certificate creation dropdown when you start the process to generate or import a certificate.

 

ImportCertificate.png

In this case the procedure will be simpler, since you'll just need to assign a name to the certificate, browse your computer to find the right PFX file and provide the password.

Register a new Azure application

In order to access to our Key Vault, we need a way to connect to it through protected credentials. The way to do that is by registering a new application in Azure, which will have access to our certificate. Then, the Azure Sign Tool utility will connect to the Key Vault through the credentials associated to our application.

 

Let's start the process. Go back to the home page of your Azure portal and choose Azure Active Directory, then move to App registrations. Click on New registration to start the process.

 

NewRegistration.png

 

Give a name to your application, then leave the default settings. We aren't going to use this application to enable the Microsoft Identity platform, so we can use the standard configuration.

 

RegisterAnApplication.png

The next step is to treat the application as a public client, since we are in a scenario where a redirect URI is not used (again, we aren't using this registration to enable authentication in an web or desktop application to leverage features like SSO or Microsoft Graph). Move to the Authentication section and, under Advanced settings, move the switch Treat application as a public client to Yes.

 

AdvancedSettings.png

The last step is to create a client secret, which is the password we'll need to authenticate from the Azure SignTool. Move to the Certificates & secrets section, then click on New client secret.

 

AddAClientSecret.png

Once you have pressed the Add button, you will be redirected back to the main page, where the secret will be listed together with its value. Make sure to copy it and to store it somewhere safe. You won't be able to retrieve it again. As soon as you refresh the page, the secret will be masked and there won't be any way to reveal it. You will be forced to generate a new secret.

 

There's one last information we need to store together with the client secret: the application identifier. Go back to the home of the application (by clicking on Overview) and, in the upper section, look for the value Application (client) ID:

 

ApplicationId.png

Make a note of it, since we're going to need it later. That's it for the app configuration.

 

Enable access to Key Vault

Now go back to the Key Vault you have previously created and move to the Access policies section. This is the place where we can enable our new application to access to the information stored in the Key Vault. 

 

AccessPolicies.png

 

Click on Add Access Policy to start the wizard to setup the access. The tool supports choosing one of the available templates to define the permissions we want to grant but, in our scenario, no one of them is a good fit. We can manually set the right permission using the other dropdowns. Specifically, for our scenario we need to:

 

  • Under Key permissions, enable the Sign option.
  • Under Certificate permissions, enable the Get option.

These permissions are enough for Azure SignTool: the second one will enable it to download the certificate, the first one to use it for signing the MSIX package.

 

The last important step is to specify which application is going to access to this policy. Click on Select principal and, using the internal search, look for the Azure application you have created in the previous step. In my case, for example, it's called SignToolForContoso:

 

SignToolForContoso.png

Once you have found it, click on it and then press Select at the end of the blade.

This is how the policy should look like:

 

AddAccessPolicy.png

Press Add and, when you're back to the main Access policies page, hit Save.

 

Sign the MSIX package

We have completed the configuration on the Azure side. Now we can start the process of signing the MSIX package. As first step, we need to acquire the Azure SignTool utility. Azure SignTool works like the signtool included in the Windows 10 SDK, with the difference that instead of using a local certificate, it can leverage the ones we have stored in Azure Key Vault.

The easiest way to acquire it is through the .NET Core CLI, since it's available as a .NET Core Global Tool. Make sure to have the latest .NET Core SDK installed on your machine, then open a terminal and run the following command:

 

dotnet tool install --global AzureSignTool --version 2.0.17

Once the operation has been completed, you will be able to run the command simply by typing AzureSignTool from any location. Now you will be able to sign your MSIX packages by running the following command:

 

AzureSignTool sign -kvu "https://contosoexpenses-blog.vault.azure.net/" -kvi "64fae35e-cb84-4b9f-86eb-5170d169316d" -kvs "this-is-the-secret" -kvc "AppConsult" -tr http://timestamp.digicert.com -v .\MyContosoApp.Package_1.0.1.0_x86.msix

Let's see in details all the parameters we have configured:

  • kvu is the URL of your Key Vault. You can find it in the main page of the service in the Azure portal, under DNS Name.

DNSName.png

  • kvi is the application id of the Azure app we have previously registered.

  • kvs is the client secret we have previously generated.

  • kvc is the friendly name of our certificate that we have chosen during the creation / import process.

  • tr is the URL of a timestamp server. By using this option, we can enable our signing to work even after the certificate has expired.

  • v is the path of the MSIX package we want to sign.

That's it. If we did everything correct, this is the output we should see in the terminal:

 

Terminal.png

 

Please note! Be aware that future releases of Azure SignTool will require also a new parameter to do the signing: -kvt, which is the Directory (tenant) ID that you can find in the Azure App registration page.

 

TenantId.png

This is a new requirement enforced by the most recent versions of the Azure SDK leveraged by the tool. The current version is still using the old one so, until the new version will be out, the -kt parameter won't be needed (actually it will break the tool, because the current version doesn't recognize it as a valid parameter).

What if something goes wrong?

There are two main reasons that could lead the Azure SignTool to fail:

    1. You didn't follow all the steps in the right way. It's enough to miss one of the steps (like forgetting to set the Azure app as public client or missing one of the permissions to the access policy) to move to an unsupported state.

    2. You didn't set the Publisher in the manifest of your MSIX package with the same subject you have selected for the certificate. For example, in my case I have created the certificate with subject CN=AppConsult, so the Identity section of my manifest looks like this:

       

      <Identity Name="MyContosoApp" Publisher="CN=AppConsult" Version="1.0.1.0" ProcessorArchitecture="x86" />

Installing the application

If you did everything correctly, when you double click on the MSIX package Windows will list it as a trusted package and you will be able to go on and install it:

 

TrustedPublisher.png

If you see, instead, an error like the one below, it's simply because the certificate is not trusted. Remember that, if you're using a self-signed certificate like I did so far, it isn't automatically trusted by Windows.

 

NotTrusted.png

As such, you will need to right click on the MSIX package in File Explorer, click on Properties, choose Digital Signatures and, from there, start the process to install the certificate in the Trusted People store.

 

Using Azure Key Vault as part of your CI/CD pipeline

So far we have seen how to manually use the Azure SignTool utility. However, the scenario in which can be really helpful is in a CI/CD pipeline, where we need to automate the signing operation but, at the same time, protect the certificate. Regardless if we have built our CI/CD pipeline in Azure DevOps or GitHub, the fundamentals of the operations are the same:

 

  1. We need to install the Azure SignTool on the hosted agent
  2. We need to run a script to sign the package using the same command we have just used manually from the terminal

The only difference, based on the platform you're using, is the way you're going to use to protect the sensitive information required by the tool, like the application id and the client secret. We can't expose them publicly in the pipeline, otherwise we are back to square one. Let's see how to leverage Azure Key Vault in two common platforms: Azure DevOps and GitHub Actions.

 

Using Azure Key Vault in Azure DevOps

If you don't already have a CI/CD pipeline for a desktop app on Azure DevOps, you can learn how to create one in the official documentation or in the last chapter of my free e-book.

When I use this platform, I prefer to leverage a Release pipeline to take care of the signing and deployment of the MSIX package. This way, I can define multiple deployment stages. For example, this is how my Release pipeline looks like:

 

ReleasePipeline.png

 

I have two stages: one for deployment in a testing environment and one in production environment. The deployment to the testing environment kicks in automatically whenever there's a new MSIX package (which is produced, instead, by a regular pipeline). Let's see how one of my stages look like:

 

pipeline.png

 

In this pipeline you can see the two actions we need to perform: install Azure SignTool and sign the package with it. Let's configure it. As first step, we need to use the Variables feature provided by Azure DevOps to safely store the credentials to access to Key Vault. Click on Variables, make sure you are in the Pipeline variables section and then add a new variable for each sensitive information:

 

  • The Azure Key Vault URL
  • The Azure Key Vault name
  • The application identifier
  • The client secret

After you have created them, make sure to click on the lock icon near each variable. This option will protect them, making sure that no one else (including yourself) will be able to see the value.

 

Variables.png

 

As second step, click on Agent job and make sure it's running on windows-2019. Azure SignTool is a .NET Core Global Tool, but it leverages specific Windows APIs to perform the signing. Then let's add the first task, by clicking on the + sign near the Agent job. Look for the task called .NET Core and click on Add:

 

netcoretask.png

 

Now let's configure the task to install Azure SignTool:

  • Display name will be used as a label for the step, so choose the name you prefer (in my case, I used Install Azure SignTool).
  • Command is the .NET Core command we want to perform. Choose custom, since tool isn't available in the dropdown.
  • Custom command is the .NET CLI command we want to run. Set it to tool.
  • Arguments is where we define all command parameters. Set it to install --global AzureSignTool --version 2.0.17.

InstallAzureSignTool.png

In case you're using a multi-stage deployment pipeline based on YAML instead of a traditional release pipeline, this is the equivalent YAML of the task we have just created:

 

steps:
- task: DotNetCoreCLI@2
  displayName: 'Install Azure SignTool'
  inputs:
    command: custom
    custom: tool
    arguments: 'install --global AzureSignTool --version 2.0.17'

The next step is to sign the package. Click again on + near Agent job and, this time, add a PowerShell task. Give it a name in the Display name field and, in the Type option, choose Inline. Then copy and paste the following command in the Script field:

 

& AzureSignTool sign -kvu $(AzureKeyVaultUrl) -kvi $(ClientId) -kvs $(ClientPassword) -kvc $(AzureKeyVaultName)-tr http://timestamp.digicert.com -v "$(System.DefaultWorkingDirectory)\_ContosoExpenses-Basic\CD\ContosoExpenses.Package_$(Build.BuildNumber).0_Test\ContosoExpenses.Package_$(Build.BuildNumber).0_x86.msixbundle"

We're launching the same exact command we have previously manually launched on our computer. The only difference is that the various parameters which contains sensitive information are set using the variables we have previously defined, by leveraging the Azure DevOps syntax $(variable-name). The -v parameter is the only one you will have to change, since it must point to the path of your MSIX file in your artifacts folder.

This is the equivalent YAML for a multi-stage pipeline:

 

steps:
- powershell: '& AzureSignTool sign -kvu $(AzureKeyVaultUrl) -kvi $(ClientId) -kvs $(ClientPassword) -kvc $(AzureKeyVaultName)-tr http://timestamp.digicert.com -v "$(System.DefaultWorkingDirectory)\_ContosoExpenses-Basic\CD\ContosoExpenses.Package_$(Build.BuildNumber).0_Test\ContosoExpenses.Package_$(Build.BuildNumber).0_x86.msixbundle"'
  displayName: 'Sign the package'

That's it. Now that you have a signed MSIX package, you can add another task to take care of the deployment, based on your infrastructure. In my case, for example, I'm copying the file on a blob storage on Azure.

 

Using Azure KeyVault with GitHub Actions

GitHub Actions is gaining lot of popularity and the .NET team has done a great job to support Windows developers who want to use it to build and deploy their desktop applications. Edward Skrod has prepared a detailed step-by-step guide and also helped to put together a workflow template that you can use as a starting point.

 

Compared to Azure DevOps, currently GitHub doesn't support a Release management story, but you can create multi-stage pipelines which performs the tasks in different stages. For example, you can have a single YAML file which describes both a build and a deployment task. Let's see how to add to our workflow the tasks we need to install and use Azure SignTool.

 

As first step, like we did on Azure DevOps, we need to safely store the credentials. GitHub calls them secrets and they can be added in the settings of your repository. Once you're on your GitHub repository, click on Settings then move to Secrets.

 

Secrets.png

 

From here, you just need to click on New secret and, like you did with Azure DevOps, add a new secret for each protected information: the Key Vault URL, the Key Vault name, the application id and the client secret. The only difference is that we won't have to take any extra step to protect them since secrets are already stored in a safe way. You'll be able only to update or remove a secret, no one will see its content.

 

Now you can move to your workflow and add the tasks we need to do the signing. You will have to add them after that the MSIX package has been generated so, ideally, after the Build task.

Let's start from the task to install Azure SignTool:

 

- name: Install AzureSignTool
  run: dotnet tool install --global AzureSignTool --version 2.0.17

Nothing special, it's just a script task which will execute the same command we have used before to install Azure SignTool on our PC. Let's move now to the singing task:

 

- name: Sign package
  run: |
        Get-ChildItem -recurse -Include *.msix | ForEach-Object {
        $msixPath = $_.FullName
        & AzureSignTool sign -kvu "${{ secrets.AzureClientUrl }}" -kvi "${{ secrets.AzureClientId }}" -kvs "${{ secrets.AzureClientSecret }}" -kvc ${{ secrets.AzureClientName }} -tr http://timestamp.digicert.com -v $msixPath
        }

In this case, there are a few differences compared to the Azure DevOps one. The first obvious one is that GitHub uses a different syntax to access to the secrets, which is ${{ secrets.SECRET_NAME }}. As such, the various parameters are filled with the values we have previously created in the Secrets section. The other one is that I'm using a slightly different approach to find the MSIX packages to sign. I'm using a PowerShell script which iterates through all the files stored in the build output and, only if they have the .msix extension, then I go on and use the Azure SignTool utility on it.

 

That's it. Now you can add additional tasks to the pipeline to take care of the deployment of the signed MSIX package on a website, on the Microsoft Store or any other supported approach.

 

Signing with Visual Studio

As a last "bonus information", Visual Studio 16.6 has recently added support for Azure Key Vault when you generate MSIX packages. This could be a great alternative to Azure SignTool if you're generating MSIX packages locally using the Windows Application Packaging Project. To enable this option you just have to right click on the Windows Application Packaging Project included in your solution and choose Publish → Create app packages. After you have chosen the path to create a package for sideloading (apps published on the Microsoft Store don't need to be signed, since the Store submission process will take care of that), you will see a new option in the list:

 

VisualStudioAzureKeyVault.png

 

By pressing the Select From Azure Key Vault button you will have the opportunity to login with your Azure account, specify the URL of your Azure Key Vault and select one of the available certificates, as you can see from the image below:

 

VisualStudioPickCertificate.png

 

However, I would recommend using this feature only for some specific scenarios, like you need to quickly generate and share a MSIX package with a colleague. The best approach to generate MSIX packages is to leverage a CI/CD pipeline to automate the process and to use Azure SignTool as part of it.

Wrapping up

Having a solid signing story when you choose to distribute your Windows desktop application with MSIX is critical. In this blog post we have seen how we can use Azure Key Vault to protect our code-signing certificate (and even generate it) and then, using an utility called Azure SignTool, sign the MSIX package. This approach can be extremely helpful when you enable a CI/CD approach to automatically build and deploy your MSIX packages, since you need to find the right balance between convenience (you need to find an easy to way to sign the packages as part of your pipeline) and security (you can't store in public your private certificate). Azure Key Vault and Azure SignTool are a great combination to solve this problem, since they give you the opportunity to sign your MSIX packages as part of the CI/CD pipeline but without storing it in the repository or in the Azure DevOps / GitHub project.

 

You can take a look an existing workflow on GitHub which uses this approach here.

 

Before wrapping up, I want to thank Claire Novotny who helped me figuring out a couple of issues around authentication with Azure Key Vault.

 

Happy packaging!