Instantly share code, notes, and snippets.

Embed
What would you like to do?
# on local computer:
# Add-AzureRmAccount
# Save-AzureRmContext -Path .\AzureRmProfileContext.txt
# nuget install secure-file -ExcludeVersion
# .\secure-file\tools\secure-file -encrypt .\AzureRmProfileContext.txt -secret <my_secret>
# upload AzureRmProfileContext.txt.enc to the repo root
# more info https://www.appveyor.com/docs/how-to/secure-files/
environment:
my_secret:
secure: rASZ+NtZbIUR3L01B1FjUA==
install:
- nuget install secure-file -ExcludeVersion
- secure-file\tools\secure-file -decrypt AzureRmProfileContext.txt.enc -secret %my_secret%
build_script:
# idea from https://arcanecode.com/2017/04/19/what-happened-to-save-azurermprofile/
# additional workaround from https://github.com/Azure/azure-powershell/issues/3954#issuecomment-309190303
- ps: $ctx = Import-AzureRmContext -Path $env:APPVEYOR_BUILD_FOLDER\AzureRmProfileContext.txt
- ps: $ctx.Context.TokenCache.Deserialize($ctx.Context.TokenCache.CacheData)
# just to test I am authenticated
- ps: Get-AzureRmAppServicePlan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment