Closed humblejay closed 2 months ago
@humblejay can you provide the details on the command you are running that results in the error? Also, please include a screenshot if possible. As you mentioned #292 is already open for the duplicate results, so we'll focus on the error you encountered with this bug.
Tried to reproduce this issue then found some issues. But I will retry reproduce after #367 merged.
The following is my test result with the wara_collector.ps1 version 2.0.14 (the latest script at this time).
(A) Subscription ID only (no filters): No duplicated recommendations.
$params = @{
TenantID = '00000000-0000-0000-0000-000000000000'
SubscriptionIds = '11111111-1111-1111-1111-111111111111'
}
.\1_wara_collector.ps1 @params
(B) Subscription ID with resource group filters: There are duplicated recommendations because data collection did two times against resources in the specified resource groups. The first collection is the entire subscription, second collection is the specified resource groups. This behavior seems by design because the next example (C) works correctly, but not user-friendly in my feel.
$params = @{
TenantID = '00000000-0000-0000-0000-000000000000'
SubscriptionIds = '11111111-1111-1111-1111-111111111111'
ResourceGroups = @(
'/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1',
'/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg2'
)
}
.\1_wara_collector.ps1 @params
(C) Resource group filters only: The version 2.0.14 of 1_wara_collector.ps1 works without subscription ID. So, if you want to collect some resource groups within a single subscription, you need to be specify the ResourceGroups
parameter only.
$params = @{
TenantID = '00000000-0000-0000-0000-000000000000'
ResourceGroups = @(
'/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg1',
'/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/rg2'
)
}
.\1_wara_collector.ps1 @params
Also, there are duplicating cases other than those mentioned above. I'm not yet enough research, but some resource type's recommendations such as storage accounts are duplicated if specify the ResrouceGroups
parameter.
Describe the bug
The latest 1_wara-collector.ps1 script allows selecting Tenant, Subscription, Resource Groups, Tag to scope a workload If in a single subscription and few resources groups in it are provided, the script returns all resources in all resource groups. In addition it creates duplicate entries under impacted resources. If only resource groups are provided the script errors out.
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
If resource groups are provided in the same subscription only the resources in those resource groups should be collected. The script should not error out if only resource groups are provided in the format /subscriptions//resourceGroups/
Screenshots 📷
Additional context
Separate issue was logged for duplicates Issue 292