diff --git a/src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs b/src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs index 00962bba5..c74e1bae9 100644 --- a/src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs +++ b/src/Azure.Functions.Cli/Actions/AzureActions/BaseAzureAction.cs @@ -1,9 +1,7 @@ using System; -using System.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -using Azure.Functions.Cli.Arm; using Azure.Functions.Cli.Common; using static Azure.Functions.Cli.Common.OutputTheme; using Azure.Functions.Cli.Interfaces; @@ -11,8 +9,6 @@ using Fclp; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using static Colors.Net.StringStaticMethods; -using Azure.Functions.Cli.Helpers; namespace Azure.Functions.Cli.Actions.AzureActions { @@ -33,6 +29,7 @@ abstract class BaseAzureAction : BaseAction, IInitializableAction private const string _defaultManagementURL = Constants.DefaultManagementURL; public string AccessToken { get; set; } + public string SyncAccessToken { get; set; } public bool ReadStdin { get; set; } public string ManagementURL { get; set; } public string Subscription { get; private set; } @@ -43,6 +40,10 @@ public override ICommandLineParserResult ParseArgs(string[] args) .Setup("access-token") .WithDescription("Access token to use for performing authenticated azure actions") .Callback(t => AccessToken = t); + Parser + .Setup("sync-access-token") + .WithDescription("Access token to use for performing trigger sync azure action (if different to normal)") + .Callback(t => SyncAccessToken = t); Parser .Setup("access-token-stdin") .WithDescription("Read access token from stdin e.g: az account get-access-token | func ... --access-token-stdin") diff --git a/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs b/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs index a3f1a18df..092748a84 100644 --- a/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs +++ b/src/Azure.Functions.Cli/Actions/AzureActions/PublishFunctionAppAction.cs @@ -648,7 +648,11 @@ await RetryHelper.Retry(async () => ColoredConsole.WriteLine(GetLogMessage("Syncing triggers...")); HttpResponseMessage response = null; // This SyncTriggers function calls the endpoint for linux syncTriggers - response = await AzureHelper.SyncTriggers(functionApp, AccessToken, ManagementURL); + if (string.IsNullOrEmpty(SyncAccessToken)) + { + SyncAccessToken = AccessToken; + } + response = await AzureHelper.SyncTriggers(functionApp, SyncAccessToken, ManagementURL); if (!response.IsSuccessStatusCode) { var errorMessage = $"Error calling sync triggers ({response.StatusCode}). ";