microsoft / ARI

Azure Resource Inventory - It's a Powerful tool to create EXCEL inventory from Azure Resources with low effort
MIT License
1.11k stars 396 forks source link

Not able to work in automation mode #231

Open mikes429 opened 2 weeks ago

mikes429 commented 2 weeks ago

Hello,

I just try ARI in automation mode, but I have this error :

TenantId 'XXXXXX-XXXXXX-XXXXXX' contains more than one active subscription. First one will be selected for further use. To select another subscription, use Set-AzContext. To override which subscription Connect-AzAccount selects by default, use Update-AzConfig -DefaultSubscriptionForLogin 00000000-0000-0000-0000-000000000000. Go to https://go.microsoft.com/fwlink/?linkid=2200610 for more information. System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Management.Automation.Interpreter.DynamicInstruction3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression. at CallSite.Target(Closure , CallSite , Object , String ) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at System.Management.Automation.Interpreter.DynamicInstruction`3.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) No match was found for the specified search criteria and module names 'AzureResourceInventory'.

I also try to figure out if it's possible to put subscription ID as parameter in automation mode ?

Regards,

Claudio-Merola commented 1 day ago

Hello @mikes429

Are you running it in an Automation Account?

Did you gave all the required permissions to the Automation Account Managed Identity?

It should be possible to pass the subscriptionID as a parameter in the Automation Account. In the Runbook, where you are putting the invoke-ARI command, you just need to add "-subscriptionID" as a parameter there