azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Errors \ Missing information in docs

Open georgeollis opened this issue 3 years ago • 8 comments

The documentation suggests that you can pass in a configuration file when working with Azure Automanage with the CLI.

I've created a configuration-test.json file with this information:

{ "Antimalware/Enable": true, "Antimalware/Exclusions/Paths": "", "Antimalware/Exclusions/Extensions": "", "Antimalware/Exclusions/Processes": "", "Antimalware/EnableRealTimeProtection": true, "Antimalware/RunScheduledScan": true, "Antimalware/ScanType": "Quick", "Antimalware/ScanDay": 7, "Antimalware/ScanTimeInMinutes": 120, "Backup/Enable": true, "Backup/PolicyName": "dailyBackupPolicy", "Backup/TimeZone": "UTC", "Backup/InstantRpRetentionRangeInDays": 2, "Backup/SchedulePolicy/ScheduleRunFrequency": "Daily", "Backup/SchedulePolicy/ScheduleRunTimes": [ "2023-03-20T12:00:00Z" ], "Backup/SchedulePolicy/SchedulePolicyType": "SimpleSchedulePolicy", "Backup/RetentionPolicy/RetentionPolicyType": "LongTermRetentionPolicy", "Backup/RetentionPolicy/DailySchedule/RetentionTimes": [ "2023-03-20T12:00:00Z" ], "Backup/RetentionPolicy/DailySchedule/RetentionDuration/Count": 180, "Backup/RetentionPolicy/DailySchedule/RetentionDuration/DurationType": "Days", "WindowsAdminCenter/Enable": false, "VMInsights/Enable": true, "DefenderForCloud/Enable": true, "UpdateManagement/Enable": false, "ChangeTrackingAndInventory/Enable": false, "GuestConfiguration/Enable": false, "AutomationAccount/Enable": false, "LogAnalytics/Enable": true, "LogAnalytics/Workspace": "/subscriptions/baba41cf-c01d-4a55-b6c5-ca494b802be5/resourceGroups/demo-test/providers/Microsoft.OperationalInsights/workspaces/platform-logs", "LogAnalytics/Reprovision": true, "BootDiagnostics/Enable": true }

The command run was the following:

az automanage configuration-profile create -n test-config1 -g demo-test --configuration configuration-profile.json --location uksouth

This is the error I get:

image

This log analytics workspace DOES exist. What am I missing? It is the following the suggested syntax in the docs.


Document Details

⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

georgeollis avatar Mar 21 '23 09:03 georgeollis

@calvinhzy for awareness

yonzhan avatar Mar 21 '23 09:03 yonzhan

@georgeollis Wondering if the logged in user have access to the workspace as the error code said forbidden. Have you tried the command without log analytics params and did that work? Including service team to take a look as well.

calvinhzy avatar Mar 22 '23 03:03 calvinhzy

@georgeollis Wondering if the logged in user have access to the workspace as the error code said forbidden. Have you tried the command without log analytics params and did that work? Including service team to take a look as well.

@calvinhzy

The user has full owner permissions on the subscription.

If I remove the workspace, I get the issue that it's required if I also have reprovision added.

image

After removing both Workspace and Reprovsion, the deployment works successfully. However, I need the ability to specify an existing LA workspace.

georgeollis avatar Mar 22 '23 09:03 georgeollis

Wrote a bicep file

param customProfileName string param location string param logAnalyticsWorkspace string param LogAnalyticsBehavior bool = false

resource customProfile 'Microsoft.Automanage/configurationProfiles@2022-05-04' = { name: customProfileName location: location properties: { configuration: { 'BootDiagnostics/Enable': true 'LogAnalytics/Enable': true 'LogAnalytics/Reprovision': LogAnalyticsBehavior 'LogAnalytics/Workspace': logAnalyticsWorkspace 'UpdateManagement/Enable': true 'VMInsights/Enable': true } } }

New-AzDeployment -TemplateFile ./test.bicep -Location uksouth -Name "test" -TemplateParameterObject @{ customProfileName = "Test"; location = "uksouth"; logAnalyticsWorkspace = "/subscriptions/baba41cf-c01d-4a55-b6c5-ca494b802be5/resourceGroups/demo-test/providers/Microsoft.OperationalInsights/workspaces/platform-logs"; LogAnalyticsBehavior = $true }

This works, which confirms I have the correct access. Is there an issue with Azure CLI?

georgeollis avatar Mar 22 '23 10:03 georgeollis

Hey @georgeollis. Automanage engineer here.

I've just tested creating a profile with the LogAnalytics parameters and everything seems to be working fine. I did run into a forbidden issue, but I solved it by running az login --use-device-code and then set my subscription with az account set --subscription <subId>. After that I was able to create a profile.

SMITTY-94 avatar Mar 22 '23 17:03 SMITTY-94

Will look into it @georgeollis, maybe something to do with CLI auth. Thanks.

calvinhzy avatar Mar 22 '23 23:03 calvinhzy

@georgeollis I was able to get it working right away. Have you perhaps tried Andrew's suggestion? image

It is possible the subscription has not been switched to be the default. You can check with this command az account show -n baba41cf-c01d-4a55-b6c5-ca494b802be5 and see if the field isDefault=true image

calvinhzy avatar Mar 24 '23 10:03 calvinhzy

I'm having the same issues here

ghostme avatar May 24 '23 18:05 ghostme