Skip to content

Instantly share code, notes, and snippets.

@IlyaFinkelshteyn
Created December 13, 2017 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IlyaFinkelshteyn/8db37a44cc78126ba86d9075f020a947 to your computer and use it in GitHub Desktop.
Save IlyaFinkelshteyn/8db37a44cc78126ba86d9075f020a947 to your computer and use it in GitHub Desktop.
# 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