diff --git a/builder/azure/common/vault.go b/builder/azure/common/vault.go index 94f6d3503..3ab48c692 100644 --- a/builder/azure/common/vault.go +++ b/builder/azure/common/vault.go @@ -7,6 +7,7 @@ package common import ( + "fmt" "net/http" "strings" @@ -60,6 +61,15 @@ func (client *VaultClient) GetSecret(vaultName, secretName string) (*Secret, err return nil, err } + if resp.StatusCode != 200 { + return nil, fmt.Errorf( + "Failed to fetch secret from %s/%s, HTTP status code=%d (%s)", + vaultName, + secretName, + resp.StatusCode, + http.StatusText(resp.StatusCode)) + } + var secret Secret err = autorest.Respond(