I'm trying to create VM using Azure Powershell. So i've imported Azure pulish settings file from portal. When i run any of the commands like "Get-AzureLocation" or "Get-AzureVM" etc i'm getting below exception. Need any help or suggestions.
PS C:\Users\YVM> Get-AzureVM
Get-AzureVM : "An exception occurred when calling the ServiceManagement API. HTTP Status Code: 407. Service Error Code: . Message: . Operation Tracking ID: ."
At line:1 char:1 + Get-AzureVM + ~~~~~~~~~~~ + CategoryInfo : CloseError: (:) [Get-AzureVM], ServiceManagementClientException + FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.IaaS.GetAzureVMCommand
Can you run the command with the -Debug option, or using $DebugPreference=Continue. This should provide a debug trace with some more details about where the call is failing and the exact message you're getting back.
Related
While trying to connect Azure from Powershell getting below error:
PS H:\> Connect-AzureRmAccount
Connect-AzureRmAccount : An error occurred while sending the request.
At line:1 char:1
+ Connect-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzureRmAccount], HttpRequestException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
Couple of things to try :
Sometime , powershell cmdlet doesn't give proper error message as it suppressed it , to get the actual error you can try executing with -debug attribute or you can try using DebugPreference like below.
$DebugPreference = "Continue"
Write-Debug -Message "Hello, World"
Alternatively ,Connect-AzureRMAccount cmdlet used TLS 1.0 by default for connecting to azure and sometime it gets blocked by the organization security policy,
Can you setting up something like below:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Additional reference:
Connect-AzureRmAccount : accessing_ws_metadata_exchange_failed
Hope it helps.
I have create Azure SQL Managed Instance and I want to create client VM that will be used to access the instance. I have copied the configuration script from the Azure portal:
When I execute this script via PowerShell, I'm getting the following error:
New-AzureRmResourceGroupDeployment : 5:06:13 PM - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'azuredeploy' is not valid according to the
validation procedure. The tracking id is '8bc76e8d-3070-44a3-bc43-58bbeeac20d8'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.
At line:179 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
New-AzureRmResourceGroupDeployment : 5:06:14 PM - Error: Code=QuotaExceeded; Message=Operation results in exceeding quota limits of Core. Maximum allowed: 100, Current
in use: 100, Additional requested: 2. Please read more about quota increase at http://aka.ms/corequotaincrease.
At line:179 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName $resourceGroupN ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceGroupDeploymentCmdlet
If these some explanation why this error happens and hot to see what is the current quota?
The first error shows that you have InvalidTemplateDeployment. You could execute this script with Invoke-Command here to run commands on local and remote computers. Once you copy this script to your power shell command line, you would need to set the password for VM and execute the script. Once you execute the script, you will see that it deployed your VM. You can get more details from this step by step.
For the second error. The quota is for each individual region, not for the entire subscription. You can use the Get-AzureRmVMUsage -Location "South Central US" command to find virtual machine quotas with a specific location. You can get more reference about resolving errors for resource quotas.
newbie at Github.
I have forked the repro of Azure Quickstart Templates and changed the "install_lamp_moodle.sh" for the "moodle-singlevm-ubuntu" to fit my needs but I cant seem to be able to test this as every-time the newuserscript part of the azuredeploy.json template (which I have locally stored), fails
I have changed the path to the installscript URI from:
"installScriptUri": "[concat('https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",`
to
"installScriptUri": "[concat('https://github.com/albertramsbottom/azure-quickstart-templates/blob/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]",
And I am using Azure power-shell to create the resource Group and run the template
fails every time on a 404 error for the newuserscript
Obviously doing something very silly here. As I do not know Github I dont want to make changes to anything and thought that by forking the repro I could attempt this. And I have no idea where is newuserscript lives, I assume its an extension for Linux.
New-AzureRmResourceGroupDeployment : 08:56:02 - Resource Microsoft.Compute/virtualMachines/extensions
'myVM/newuserscript' failed with message 'The resource operation completed with terminal
provisioning state 'Failed'.'At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
New-AzureRmResourceGroupDeployment : 08:56:02 - VM has reported a failure when processing extension 'newuserscript'.
Error message: "Script returned an error.
---stdout---
---errout---
install_lamp_moodle.sh: 6: install_lamp_moodle.sh: Syntax error: newline unexpected
".At line:1 char:1
+ New-AzureRmResourceGroupDeployment -ResourceGroupName mygroup -TemplateFile C:\T ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-AzureRmResourceGroupDeployment], Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResourceGroupDeploymentCommand
I know this sounds like an Azure quickstart issue but I think it is really a lack of understanding of GitHub and how to use a forked repro
And I aslo assume this has noting to do with the moodle-singlevm-ubuntu template and has more to do with my idiocy :)
Sorry #
You want to link to the "raw" file URI like in the original template. So something like:
"installScriptUri": "[concat('https://raw.githubusercontent.com/albertramsbottom/azure-quickstart-templates/master/moodle-singlevm-ubuntu/', variables('installScriptName'))]"
Note that that location has to be publicly accessible. For a model on how to stage artifacts in a private location you can take a look at this repo:
https://github.com/bmoore-msft/AzureRM-Samples
I'm getting this error when running Login-AzureRmAccount in PowerShell:
Login-AzureRmAccount : The browser based authentication dialog failed to complete. Reason: The request could not be
processed by the server due to invalid syntax.
At line:1 char:1
+ Login-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-AzureRmAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.Azure.Common.Authentication.AadAuthenticationFailedException,Microsoft.Azure.Comm
ands.Profile.AddAzureRMAccountCommand
I see the login window pop up briefly, but it closes immediately and this error message displays.
It turned out my proxy settings were preventing me from connecting to the internet. Once I corrected my proxy settings I was able to log into Azure as expected. Not sure what the "invalid syntax" error is all about...
Run add-azureaccount
it will ask for credential, enter the credential.
then run Connect-azAccount it will again ask for the credential, provide the credentials and it will work fine
What ever command I run from the Windows Azure PowerShell module, I get the same error. Example:
Get-AzureStorageAccount : 'Content-Type' is an unexpected token. The expected token is '"' or '''. Line 2, position 18.
At line:1 char:24
+ Get-AzureStorageAccount <<<< -StorageAccountName "bzyeastussys"
+ CategoryInfo : CloseError: (:) [Get-AzureStorageAccount], XmlException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Management.ServiceManagement.StorageServices.GetAzureStorageAccountCommand
I am completely stumped on what the problem is.
I have successfully set my subscription details (I can do a "Get-AzureSubscription") but any command I use that is calling out to the Azure services gives me this error about "Content-Type" being an unexpected token. I am able to use the old "Windows Azure PowerShell Cmdlets" without issue.
Any ideas on what the issue with "Windows Azure PowerShell" might be?
Thanks.
The issue is down to there being an internet proxy being used. The request is being challenged for authentication, hence the error.