Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-AzureKeyVaultSecret does not recognize vaultName #1524

Closed
bmoore-msft opened this issue Dec 18, 2015 · 22 comments
Closed

Set-AzureKeyVaultSecret does not recognize vaultName #1524

bmoore-msft opened this issue Dec 18, 2015 · 22 comments
Labels
KeyVault Service Attention This issue is responsible by Azure service team.

Comments

@bmoore-msft
Copy link

I have an old script I dusted off in the 1.0.2 release, Set-AzureKeyVaultSecret seems to have regressed:

New-AzureRMKeyVault -VaultName $vaultName -ResourceGroupName $resourceGroupName -Location eastus
Set-AzureKeyVaultSecret -VaultName $vaultName -Name adminPassword -SecretValue (ConvertTo-SecureString -String 'secretpassword' -AsPlainText -Force)

Now the set cmdlet returns:

Set-AzureKeyVaultSecret : The remote name could not be resolved: '.vault.azure.net'
At line:1 char:1

  • Set-AzureKeyVaultSecret -VaultName $vaultName -Name test -SecretValue (ConvertTo ...
  • - CategoryInfo          : CloseError: (:) [Set-AzureKeyVaultSecret], WebException
    - FullyQualifiedErrorId : Microsoft.Azure.Commands.KeyVault.SetAzureKeyVaultSecret
    
    

Even though the vault was created just fine...

@joshmouch
Copy link

Any idea why this error message occurs? I'm also getting a "The remote name could not be resolved: '*.vault.azure.net", except I get it when running Set-AzureRmVMDiskEncryptionExtension.

@ghost
Copy link

ghost commented Jul 8, 2016

I'm seeing this as well, many months later. Did anyone ever try to resolve this? Is the key vault team in the know?

@rajaprad
Copy link

Same here, this is very strange! works sometime and not the other time!
Do we have any updates on this.

@markcowl, could you please have a look here.

Thanks,
Pradebban Raja

@mbukosky
Copy link

+1

4 similar comments
@xinyi-joffre
Copy link

+1

@clintonm9
Copy link

+1

@Kandarp2516
Copy link

+1

@Technolink
Copy link

+1

@diahughes
Copy link

Same here, works one minute then not the other.

@davoodharun
Copy link

+1

1 similar comment
@wbreza
Copy link

wbreza commented Mar 27, 2017

+1

@kpratik16
Copy link

It was due to invalid dns cache for me. Flushing out dns cache fixed it.

Command: ipconfig /flushdns

@LukeDearden
Copy link

LukeDearden commented Apr 20, 2017

I use this to trap it. Seems to be an intermittent problem

 $VaultURI = ([System.Uri](Get-AzureRmKeyVault -VaultName myVault).VaultURI).Host
    $DnsCheck = Resolve-DnsName $VaultURI -ErrorAction SilentlyContinue

     if (!$DnsCheck) {
        write-host "AZURE BUG : Resolve-DnsName could not resolve vault name. Keep trying!"
        exit
    }

eventually it works :/

@maddieclayton
Copy link
Contributor

Closing in favor of #5326

@pixelicous
Copy link

Dont understand why this is closed, this is open since 2015, i just reinstated on another issue that it still exists face palm

@bsiegel bsiegel added the Service Attention This issue is responsible by Azure service team. label Sep 26, 2018
@dmarlow
Copy link

dmarlow commented Feb 21, 2019

Also running into this.

@placidseven
Copy link

This issue is still unresolved.
This is also clearly an issue with the module!

image

If I can find the resource with Get-AzKeyVault then I should be able to find it with Set-AzKeyVaultSecret or Get-AzKeyVaultSecret.
Someone needs to look at this.

@dmarlow
Copy link

dmarlow commented Sep 10, 2019

I run into strange stuff all the time related to DNS. I think it's deeper than these instances related to KeyVault. I often times get failures resolving the Let's Encrypt endpoint. One thing in common on all occurrences is the fact that it's .NET under the covers.

@placidseven
Copy link

placidseven commented Sep 23, 2019

For anyone that finds this problem @LukeDearden stated eventually the request will go through. Takes up to 10 min for me at times.

function setSecret{
    while (!$secret) {
        write-host "Resolve-DnsName could not resolve $vaultName. Keep trying!"
        Start-Sleep -Seconds 30
        $secret = Set-AzKeyVaultSecret -VaultName $vaultName -Name $secretName -SecretValue $secretString -ErrorAction SilentlyContinue
    }
}

$secret = Set-AzKeyVaultSecret -VaultName $vmVaultName -Name $secretName -SecretValue $secretString -ErrorAction SilentlyContinue
setSecret
}

Not sure if increasing the frequency of the request would increase chances of a successful call. I also have an almost identical code block for Get-AzKeyVaultSecret. Unfortunately this module is necessary for my deployment automation so I have to make due.

@pixelicous
Copy link

The keyvault cmdlets in powershell always had issues, instead of the api returning an object after the hostname have been propogated successfully the cmdlet have a sleep function, i know this by a fact as we opened a ticket to microsoft requesting this to be fixed and the product team only added a minute and a half sleep, stating why it is supposed to solve it.

Part of that matter, keyvault and storage account endpoints have constant issues during the two and a half years i have been working with them, very unreliable infrastructure.

p.s - the python libraries aren't any better ;)

@seabrin
Copy link

seabrin commented Jul 23, 2021

I know this issue is closed but I just ran into this error in July 2021 and found a pretty simple workaround that works consistently. Somewhere in my online troubleshooting travels, a poster mentioned that get-azkeyvault (without any parameters) worked even though get-azkeyvaultsecret failed to resolve the remote name. So I assigned get-azkeyvault to a variable and used the vaultname property ($varVault.VaultName). I used that for the get-azkeyvaultsecret -vaultname parameter and it works. Every time. Hopefully this helps someone.

$varVault = get-azkeyvault
get-azkeyvaultsecret -VaultName $varVault.VaultName -Name ""

@RDavis3000
Copy link

this is embarrassing; I was using the -VaultName arg and for me the error was caused by the value I was giving it was just the wrong string.
It was trying to access a KeyVault which didn't exist.
So for those who come after, double check your value!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
KeyVault Service Attention This issue is responsible by Azure service team.
Projects
None yet
Development

No branches or pull requests