Giter Club home page Giter Club logo

Comments (13)

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

Hello,

This is very strange. Running the inventory for other environments is ok?

The types of resources in the tenant are like VMs and AKS and etc?

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

No, the subscription is sum in another variable....

I'm starting to suspect the script is failing to collect the other resources because some property of the second resource is crashing the Azure Resource Graph query...

Can you run the following?

Just to see if more resources are listed:

az login -t TENANTID

$GraphQuery = "resources | where strlen(properties.definition.actions) < 123000 | project id,name,type,tenantId,kind,location,resourceGroup,subscriptionId,managedBy,sku,plan,properties,identity,zones | order by id asc"

az graph query -q $GraphQuery --skip $Limit --first 1000 --output json --only-show-errors

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

Ok,

The only parameters you are using when running the script are: -tenantID and -SecurityCenter?

What version of az cli and resource-graph extension are you running?

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

I just tested with the exact same version and it runs normally.

Let's see what is this one resource it is reporting...

Can you see what is inside the variable $Resources after the script is run?

Thanks

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

May you run the following to see the types of resources being collected?

az login -t TENANTID

$Global:Resources = @()
$GraphQuery = "resources | where strlen(properties.definition.actions) < 123000 | summarize count()"
$EnvSize = az graph query -q $GraphQuery --output json --only-show-errors | ConvertFrom-Json
$EnvSizeNum = $EnvSize.data.'count_'

Write-Host ('Resources counted: '+$EnvSizeNum)

if ($EnvSizeNum -ge 1) {
$Loop = $EnvSizeNum / 1000
$Loop = [math]::ceiling($Loop)
$Looper = 0
$Limit = 0

while ($Looper -lt $Loop) {
    $GraphQuery = "resources | where strlen(properties.definition.actions) < 123000 | project id,name,type,tenantId,kind,location,resourceGroup,subscriptionId,managedBy,sku,plan,properties,identity,zones,extendedLocation$($GraphQueryTags) | order by id asc"
    
    $Resource = (az graph query -q $GraphQuery --skip $Limit --first 1000 --output json --only-show-errors).tolower() | ConvertFrom-Json

    write-host ('Resources Inside Loop: '+$Resource.data.count)

    $Global:Resources += $Resource.data
    Start-Sleep 2
    $Looper ++
    $Limit = $Limit + 1000
}

}

$Resources | Group-Object -Property type | Select-Object -Property Name,Count | Sort-Object -Property count -Descending

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

dmonkcbts avatar dmonkcbts commented on May 27, 2024

from ari.

Claudio-Merola avatar Claudio-Merola commented on May 27, 2024

I've been trying to think of any case that may cause that issue.

But so far I cannot see any reason for that to happen. I have try the same versions, a similar environment size, similar type of resources but it always works.

Since we are getting a newer version of the script ready, I believe the best approach would be to wait for the newer version to be release and see how it behaves in that environment.

from ari.

github-actions avatar github-actions commented on May 27, 2024

This Issue is stale and may be automatically close soon.

from ari.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.