microsoft / oxa-tools

Open edX on Azure Tools
MIT License
36 stars 103 forks source link

Deployment Failed: Azure Call Failure [Find-AzureRmResource] #336

Closed sanjay186 closed 6 years ago

sanjay186 commented 6 years ago

Hi Elton

I have tried to deploy oxa/master.fic but I got an error which is related "Find-AzureRmResource".

AzureRM version

AzureRM 6.0.1 C:\Program Files\WindowsPowerShell\Modules\AzureRM\6.0.1\AzureRM.psd1

This is a error i got while deploying openEDx ficus.

Failed: Azure Call Failure [Find-AzureRmResource]: Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from resource group 'openedxtrn' failed. Error: The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\fenil\oxa-tools\scripts\Deploy-OxaStamp.ps1:197 char:5

please help me to resolving this issue.

Thanks in advance

eltoncarr commented 6 years ago

Did you install the pre-requisites?

sanjay186 commented 6 years ago

Yes i have installed all pre-requisites. When i tried to create the Azure active dirtectory from the given portal in the document https://manage.windowsazure.com it was redirected to the new portal https://portal.azure.com and i created my active directory from there. so i doubt , will this cause any problem ?

sanjay186 commented 6 years ago

And i also found this issue..

Please Check the below logs.

ResourceGroupName : Openedx Location : centralus ProvisioningState : Succeeded Tags : ResourceId : /subscriptions/c24f5af3-40a1-4a11-8108-48640ba4852b/resourceGroups/Openedx

[2018-05-30 19:30:07Z] :: Falling back to default value: c:\Users\sanjay\oxa-tools\config\stamp\default\parameters.json for parameter KeyVaultDeploymentParametersFile since no value was provided [2018-05-30 19:30:07Z] :: Falling back to 'san###jay.i####ech@gmail.com' since a platform email address was not specified. [2018-05-30 19:30:07Z] :: Falling back to 'C*****gkj' since a password for the Edx App Super User was was not specified. [2018-05-30 19:30:07Z] :: Falling back to 's######rtech@gmail.com' since a password for the Edx App Super User Email was was not specified. [2018-05-30 19:30:07Z] :: Falling back to service principal 'cf38633f-a68f-40b9-a032-00afe5b1ffe1' to derive the keyvault admin user object Id since it was not specified. [2018-05-30 19:30:08Z] :: Finding OXA Azure resources - Attempt [1|3] - Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from resource group 'Openedx' started. [2018-05-30 19:30:08Z] ::

elia368 commented 6 years ago

I am facing the same issue rror [System.Management.Automation.RuntimeException]:

zure Call Failure [Find-AzureRmResource]: Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from source group 'uraceds00' failed. Error: The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, fun ion, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path s correct and try again.

SMessageDetails : xception : System.Management.Automation.RuntimeException: Azure Call Failure [Find-AzureRmResource]: Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from resource group 'uraceds00' failed. Error: The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. argetObject : Azure Call Failure [Find-AzureRmResource]: Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from resource group 'uraceds00' failed. Error: The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ategoryInfo : OperationStopped: (Azure Call Fail... and try again.:String) [], RuntimeException ullyQualifiedErrorId : Azure Call Failure [Find-AzureRmResource]: Fetching all azure resources of 'Microsoft.Network/loadBalancers' type from resource group 'uraceds00' failed. Error: The term 'Find-AzureRmResource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. rrorDetails : nvocationInfo : System.Management.Automation.InvocationInfo criptStackTrace : at Start-AzureCommand, C:\laas\oxa-tools\scripts\Common.ps1: line 825 at Find-OxaResource, C:\laas\oxa-tools\scripts\Common.ps1: line 940 at Get-OxaNetworkResources, C:\laas\oxa-tools\scripts\Common.ps1: line 883 at , C:\laas\oxa-tools\scripts\Deploy-OxaStamp.ps1: line 271 at , : line 1 ipelineIterationInfo : {}

eployment Failed: Azure Call Failure [Find-AzureRmResource]: Fetching all azure resources of Microsoft.Network/loadBalancers' type from resource group 'uraceds00' failed. Error: The term 'Find-AzureRmResource' s not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, r if a path was included, verify that the path is correct and try again. t C:\laas\oxa-tools\scripts\Deploy-OxaStamp.ps1:197 char:5 throw "Deployment Failed: $($_)";


   + CategoryInfo          : OperationStopped: (Deployment Fail... and try again.:String) [], RuntimeException
   + FullyQualifiedErrorId : Deployment Failed: Azure Call Failure [Find-AzureRmResource]: Fetching all azure resourc
  es of 'Microsoft.Network/loadBalancers' type from resource group 'uraceds00' failed. Error: The term 'Find-AzureRm
 Resource' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spellin
g of the name, or if a path was included, verify that the path is correct and try again.
egonid commented 6 years ago

Hi

I had experienced same issue under AzureRM 6.0.1 but I had no error on AzureRM 5. Maybe the "Find-AzureRmResource" was deprecated in AzureRM 6.0 Version.

Because, You can search the Find-AzureRmResource cmdlet, but there is no result. https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/find-azurermresource?view=azurermps-6.0.0

but you can get results under AzureRm 5.0 . https://docs.microsoft.com/en-us/powershell/module/azurerm.resources/find-azurermresource?view=azurermps-5.7.0

I think that there are two option for this issue.

  1. Use AzureRM 5 Version (I Choose this option)
  2. Change the "Find-AzureRmResource" cmdlet to the other "Get-AzureRmResource".

Also, you can check the below link. https://github.com/Microsoft/oxa-tools/issues/331#issuecomment-391676773

Thanks

sanjay186 commented 6 years ago

Hi elia368

what version of AzureRM your using ?

sanjay186 commented 6 years ago

Hi egonid

I tried using AzureRm 5.0 but still i'm getting the same error And i dont have any idea how to change the "Find-AzureRmResource" cmdlet to the other "Get-AzureRmResource"

can you help me in changing the cmdlet?

elia368 commented 6 years ago

I started having the same error with 6.0.1 and I am still getting it with 5.0 too

sanjay186 commented 6 years ago

Even i tried in 5.0 but still im getting the same error

egonid commented 6 years ago

Sanjay186

How is the result of below command?

Get-Module AzureRM -Listavailable | Select-Object -property name, version, path

My result is only one , AzureRM 5.0.1 C:\Program Files\WindowsPowerShell\Modules\AzureRM\5.0.1\AzureRM.psd1

Maybe the below procedures helps you.

  1. Uninstall "Microsoft Azure PowerShell - xx" via control panel-program uninstall.
  2. Execute Windows PowerShell ISE as admin mode. Run below command.

Set-ExecutionPolicy Bypass

get-module azurerm -listavailable | select-object -property name,version,path -> it must have no result.

Install-Module -Name AzureRM -RequiredVersion 5.0.1 -> Waiting for the end of installing.

import-module -name AzureRM

get-module azurerm -listavailable | select-object -property name,version,path -> it shows that only one result. AzureRM 5.0.1 C:\Program Files\WindowsPowerShell\Modules\AzureRM\5.0.1\AzureRM.psd1

Thanks.

sanjay186 commented 6 years ago

Hi egonid

Thank you so much I followed the above steps and that issue is resolved and started deploying . In the middle of deployment Im getting this error

New-AzureRmResourceGroupDeployment : 2:57:22 PM - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'stamp-v2' is not valid according to the validation procedure. The tracking id is '4b**b-900e-4**8422-9011-bd3a7e5efc26'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details.

At C:\Users***\oxa-tools\scripts\Common.ps1:727 char:33

please advice me on the above issue Thanks!!

elia368 commented 6 years ago

Many thanks to egonid, The above steps helped me too

sanjay186 commented 6 years ago

Hi elia368

Is the deployment successful? were you able to open the default openedx site??

EliasPI commented 6 years ago

I have the same error as sanjay186

elia368 commented 6 years ago

Hello, The first step of deployment succeeded with no email notifications,my traffic manager endpoints are also degraded so I cannot access the sites

@sanjay186 would you share details about the error?

egonid commented 6 years ago

Hi

I got the same error another PC. I think that my Azure PowerShell maybe conflict. But I fix it below steps.

First, reference below links http://techgenix.com/powershell-errors-term-not-recognized/ https://www.powershellgallery.com/packages/AzureRM/5.0.1

Steps.

  1. Remove all AzureRm module in your pc

    1-1.Check current module (I had run in Windows PowerShell ISE) get-module azurerm -listavailable | select-object -property name,version,path 1-2. If your get some result like below. AzureRM 5.0.1 C:\Program Files\WindowsPowerShell\Modules\AzureRM\5.0.1\AzureRM.psd1 AzureRM 6.0.0 C:\Program Files\WindowsPowerShell\Modules\AzureRM\6.0.0\AzureRM.psd1 …. 1-3. remove those versions this cmdlet like below Uninstall-Module -name AzureRM -RequiredVersion 5.0.1 Uninstall-Module -name AzureRM -RequiredVersion 6.0.0

1-4. Check that there is no installed Azure PowerShell (After above jobs) get-module azurerm -listavailable | select-object -property name,version,path -> no result 1-5. close Windows powershell ISE

  1. Cleaning the previous version of AzurRM install.

    2-1.In file explorer, navigate to the below path. C:\Program Files\WindowsPowerShell\Modules

2-2. if existed, delete all related AzureRM folders. ex) AzureRM, AzureRM.Storage, AzureRM.Backup etc.

  1. Reinstall AzureRM Module

    3-1. Reopen Window Powersell ISE. 3-2. Run below cmdlet. (reference https://www.powershellgallery.com/packages/AzureRM/5.0.1) Save-Module -Name AzureRM -Path "C:\Program Files\WindowsPowerShell\Modules" -RequiredVersion 5.0.1 3-3. After 3-2 , you can see some folder are created in that path.

  2. Check the Azure Powershell.

4-1. Reopen Windows Powershell ISE. 4-2. run get-module azurerm -listavailable | select-object -property name,version,path -> It must show 1 result. run Get-Module -> In my case, the result like below. image

  1. Run oxa-deploy script via powershell ISE

I hope this may helps.

Thanks.

eltoncarr commented 6 years ago

Did this work for you all? Or are you still having issues with powershell?

sanjay186 commented 6 years ago

It worked for me but i have a issue in middle for the deployment .

VERBOSE: Performing the operation "Creating Deployment" on target "TrnJP". New-AzureRmResourceGroupDeployment : 8:06:06 PM - Error: Code=InvalidTemplateDeployment; Message=The template deployment 'stamp-v2' is not valid according to the validation procedure. The tracking id is '4515c581-ce7b-4b01-a453-7c2041e9d271'. See inner errors for details. Please see https://aka.ms/arm-deploy for usage details. At C:\Users\sanjay\oxa-tools\scripts\Common.ps1:727 char:33

New-AzureRmResourceGroupDeployment : 8:06:07 PM - Error: Code=QuotaExceeded; Message=Operation results in exceeding quota limits of Core. Maximum allowed: 10, Current in use: 0, Additional requested: 12. Please read more about quota increase at http://aka.ms/corequotaincrease. At C:\Users\sanjay\oxa-tools\scripts\Common.ps1:727 char:33

New-AzureRmResourceGroupDeployment : The deployment validation failed At C:\Users\sanjay\oxa-tools\scripts\Common.ps1:727 char:33

[2018-06-01 20:06:19Z] :: Deploying - Attempt [1|3] - Deploying OXA Stamp to 'TrnJP' completed. [2018-06-01 20:06:19Z] :: Unable to execute the Stamp Deployment to TrnJP [2018-06-01 20:06:19Z] :: Cleaning up temporary parameter file [2018-06-01 20:06:19Z] ::

########################################################################### ERROR ENCOUNTERED ###########################################################################

Error [System.Management.Automation.RuntimeException]:

Unable to execute the Stamp Deployment to TrnJP

PSMessageDetails : Exception : System.Management.Automation.RuntimeException: Unable to execute the Stamp Deployment to TrnJP TargetObject : Unable to execute the Stamp Deployment to TrnJP CategoryInfo : OperationStopped: (Unable to execu...oyment to TrnJP:String) [], RuntimeException FullyQualifiedErrorId : Unable to execute the Stamp Deployment to TrnJP ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at , C:\Users\sanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1: line 388 at , : line 1 PipelineIterationInfo : {}

Deployment Failed: Unable to execute the Stamp Deployment to TrnJP At C:\Users\sanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1:197 char:5

Please help me in solving this issue thanks in advance

elia368 commented 6 years ago

Hello Sanjay186, I have had the same issue,it's about cpu cores if you reduce vm sizes in parametres.json, and parameters-v3.json,it will help jumpBoxVmSize": { "value": "Standard_D1_v2" }, "mongoVmSize": { "value": "Standard_D1_v2" }, "mysqlVmSize": { "value": "Standard_D1_v2" }, "frontendVmSize": { "value": "Standard_D1_v2" I am facing an issue of traffic manager endpoints which cannot go online,I don't know if it's beacause of Vm sizes. It's also possible to request an increase of cpu cores in a given region. Thank You

eltoncarr commented 6 years ago

@elia368 , if your traffic manager endpoint cannot go online, that means the application didn't bootstrap correctly.

Is the core issue tracked here (re: Find-AzureRmResource) addressed now? It'd would be great to keep issues separate and distinct for tracking purposes.

elia368 commented 6 years ago

@eltoncarr the core issue was fixed based on the steps mentioned above. Then what can I do to fix this issue(Endpoints Degraded),I redeployed many times but still facing the same issue I am using a Pay As You Go Subscription--->Basic SKU may this be a reason? All Vms are running and I am able to login.

Thank You

eltoncarr commented 6 years ago

Is your deployment failing? If the email is setup, it should notify you of the error with full details. Degraded endpoint means the setup failed.

sanjay186 commented 6 years ago

@eltoncarr The cores issue is fixed when the ARM cores values are increased. The deployment was successful but can't access the LMS due to the endpoint degraded error

i din't get any logs in my mail.

eltoncarr commented 6 years ago

In that case, you'd need revisit the email settings. We've covered this in some details at https://aka.ms/laas

sanjay186 commented 6 years ago

@elia368 is your issue on endpoints degraded solved ?? im facing the same issue.. did you find any workaround?

elia368 commented 6 years ago

I am still having the same issue and what is strange for me is that before May 12 I successfully deployed OpenEdx.,I only had a certificate issue. At the end of may when I tried a redeployment after changing certificates files only, I faced the endpoints degradation issue. Up to now I don't know what to do as I did many trials which gave me the same issue. (In all cases I haven't received email notifications.)

sanjay186 commented 6 years ago

@eltoncarr should i deploy it from the scratch ?? could you please advice me to solve this issue ??

eltoncarr commented 6 years ago

Generally, you'd want to do a clean deployment each time, using a different resource group name.

eltoncarr commented 6 years ago

Regarding the Azure Call Failure [Find-AzureRmResource] concern, I have confirmed that this is related to changes in the Azure Powershell cmdlet update. Since version 6.0.0, the Find-AzureRmResource cmdlet was dropped and its functionality has been merged with Get-AzureRmResource (Release Notes)

Mitigation: You'd need to specify the version of the AzureRM powershell cmdlets you'd want to install like:

If you have already installed the latest version, you'd want to uninstall it.

sanjay186 commented 6 years ago

@eltoncarr
I did a fresh deployment as you suggested. I'm getting this error I double check all the values which i'm passing in that command line please help me in solving this issue

Get-AzureRMADServicePrincipal

: Method not found: 'System.Collections.Generic.List`1 Micros oft.Azure.Graph.RBAC.Version1_6.ActiveDirectory.ActiveDirectoryClient.FilterServicePrincipals(Microsoft.Azure.Graph.R BAC.Version1_6.ActiveDirectory.ADObjectFilterOptions)'. At C:\Users\SSanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1:261 char:18

New-AzureRmResourceGroupDeployment : Could not find a part of the path 'C:\Users\SSanjay\oxatools\templates\stamp\stamp-keyvault.json'. At C:\Users\SSanjay\oxa-tools\scripts\Common.ps1:727 char:33

Deployment Failed: Unable to execute the KeyVault Deployment to TrainoJP At C:\Users\SSanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1:197 char:5

eltoncarr commented 6 years ago

@sanjay186, yesterday while validating I came across the issue and therefore put forth PR #351 to fix this forward. We will move this change across our branches to master.fic during as we complete validations.

sanjay186 commented 6 years ago

@eltoncarr which version of AzureRM should i use 5.7.0 or latest??

sanjay186 commented 6 years ago

@eltoncarr , I tried deploying from the scratch, installed latest version of AzureRM , cloned master.fic and changed the values in bvt and parameter.json files then tried deploying from windows powershell ISE. i got the error saying 'Azure' not recognized So i install Azure module with this command "Install-Module Azure" , After installing the Azure module i still get the same error..

Am i missing out anything??

Log-Message : [2018-06-19 05:39:45Z] :: ########################################################################### ERROR ENCOUNTERED ########################################################################### Error [System.Management.Automation.CommandNotFoundException]: The term 'azure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PSMessageDetails : Exception : System.Management.Automation.CommandNotFoundException: The term 'azure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionC ontext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Inte rpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Inte rpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() TargetObject : azure CategoryInfo : ObjectNotFound: (azure:String) [], CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Authenticate-AzureRmUser, C:\Users\SSanjay\oxa-tools\scripts\Common.ps1: line 354 at , C:\Users\SSanjay\oxa-tools\scripts\Process-OxaToolsKeyVaultConfiguration.ps1: line 93 at , C:\Users\SSanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1: line 372 at , : line 1 PipelineIterationInfo : {} Deployment Failed: Script execution failed: The term 'azure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\Users\SSanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1:197 char:5

eltoncarr commented 6 years ago

The validation is complete and the issue should be fixed. You can follow the instructions as provided and it should install the latest AzureRM module. Please make sure you are following available documentation (available here )

sanjay186 commented 6 years ago

@eltoncarr I followed all the steps given in that document but still getting the 'Azure not recognized' error. i have installed AzureRM and Azure module should i install any other module? Please do the needful.

Log-Message : [2018-06-19 05:39:45Z] :: ########################################################################### ERROR ENCOUNTERED ########################################################################### Error [System.Management.Automation.CommandNotFoundException]: The term 'azure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. PSMessageDetails : Exception : System.Management.Automation.CommandNotFoundException: The term 'azure' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionC ontext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCallInstruction2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Inte rpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(Inte rpretedFrame frame) at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0) at System.Management.Automation.PSScriptCmdlet.RunClause(Action1 clause, Object dollarUnderbar, Object inputToProcess) at System.Management.Automation.PSScriptCmdlet.DoEndProcessing() at System.Management.Automation.CommandProcessorBase.Complete() TargetObject : azure CategoryInfo : ObjectNotFound: (azure:String) [], CommandNotFoundException FullyQualifiedErrorId : CommandNotFoundException ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Authenticate-AzureRmUser, C:\Users\SSanjay\oxa-tools\scripts\Common.ps1: line 354 at , C:\Users\SSanjay\oxa-tools\scripts\Process-OxaToolsKeyVaultConfiguration.ps1: line 93 at , C:\Users\SSanjay\oxa-tools\scripts\Deploy-OxaStamp.ps1: line 372 at , : line 1 PipelineIterationInfo : {}

eltoncarr commented 6 years ago

This is most likely because you are referencing Azure CLI v1. Please update your deployment parameters to use Azure Cli v2

sanjay186 commented 6 years ago

hi @eltoncarr
Deployment was successful but the endpoint1 is degraded .. i got this log in the mail

src kt = /etc/krb5.keytab File /etc/krb5.keytab does not exist /opt/omi/bin/support/ktstrip: 38: exit: Illegal number: -1

i cant understand the above lines.. please assist me in bringing the endpoints online

eltoncarr commented 6 years ago

Ignore that. It should not be a recurring issue. If you are getting emails, you should get a notification if the installation failed and why it failed would be captured in the attached log file(s).

From the above, it seems the core issue being tracked here (Deployment Failed: Azure Call Failure [Find-AzureRmResource]) has been addressed and is fixed.

sanjay186 commented 6 years ago

@eltoncarr The endpoints degraded error has been resolved, it took few hours to come online now the default site is up and running. Thank you so much for your support.:)