public async Task <string> AcquireToken(Guid deploymentId, IAzureDeploymentArtifactsProvider azureDeploymentArtifactsProvider) { var hostname = Environment.GetEnvironmentVariable("WEBSITE_HOSTNAME"); // there is no need to do a key lookup when running on localhost // function apps running on localhost don't use api keys at all if (hostname.StartsWith("localhost", StringComparison.OrdinalIgnoreCase)) { return(null); } var json = await $"https://{hostname}/admin/functions/{functionName}/keys" .GetJObjectAsync() .ConfigureAwait(false); return(json.SelectToken("keys[0].value")?.ToString()); }
public AzureDeploymentService(IAzureDeploymentOptions azureDeploymentOptions, IAzureSessionService azureSessionService, IAzureDeploymentArtifactsProvider azureDeploymentArtifactsStorage) { this.azureDeploymentOptions = azureDeploymentOptions ?? AzureDeploymentOptions.Default; this.azureSessionService = azureSessionService ?? throw new ArgumentNullException(nameof(azureSessionService)); this.azureDeploymentArtifactsStorage = azureDeploymentArtifactsStorage ?? throw new ArgumentNullException(nameof(azureDeploymentArtifactsStorage)); }
public ArtifactTrigger(IAzureDeploymentArtifactsProvider azureDeploymentArtifactsProvider = null) { this.azureDeploymentArtifactsProvider = azureDeploymentArtifactsProvider; }