Deploying a forked repro of an azure quick start template - azure

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

Related

Azure Tag for Azure Depolyment not working

I am trying to create a Azure deployment with Tag parameter to put tag on the deployment using command New-AzResourceGroupDeployment like -
New-AzResourceGroupDeployment -ResourceGroupName "demo" -TemplateFile "D:\Templates\storage.json" -Tag #{"CreatedFrom"="PS"; "Env"="Dev";}
but facing this issue -
New-AzResourceGroupDeployment : A parameter cannot be found that matches parameter name 'Tag'.
At line:1 char:102
+ ... Name "demo" -TemplateFile "D:\Templates\storage.json" -Tag #{"Crea ...
+ ~~~~
+ CategoryInfo : InvalidArgument: (:) [New-AzResourceGroupDeployment], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.N
ewAzureResourceGroupDeploymentCmdlet
According to the documentation we can put tag parameter with New-AzResourceGroupDeployment command but its not working for me.
Any help on what I am doing wrong here would be much appreciated!
The command works fine here. Make sure you have the latest version of the commands.
https://learn.microsoft.com/en-us/powershell/azure/new-azureps-module-az?view=azps-6.1.0

Connect-AzureRmAccount - Cannot connect to Azure

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.

Unable to create client VM that access Azure Sql Managed Instance due to core quota limit

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.

Get-AzureWebSite : Requested value 'PremiumV2' was not found

I added a new Premium V2 app service plan. Now when running Get-AzureWebSite in PowerShell I'm getting the following error message:
get-azurewebsite : Requested value 'PremiumV2' was not found.
At line:1 char:1
+ get-azurewebsite
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Get-AzureWebsite], ArgumentException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Websites.GetAzureWebsiteCommand
What is the error about?
The old CmdLets are no longer well supported, and don't know about new features like Premium V2.
Try using the ARM based CmdLets instead, like Get-AzureRmWebApp.

ServiceManagement API exception calling Azure cmdlets from powershell

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.

Resources