set azuremonitoragent as primary group for azuremetricsext#2159
Open
sajithmuh wants to merge 1 commit intoAzure:masterfrom
Open
set azuremonitoragent as primary group for azuremetricsext#2159sajithmuh wants to merge 1 commit intoAzure:masterfrom
sajithmuh wants to merge 1 commit intoAzure:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This fixes a bug in the CMv2 MetricsExtension service account setup where
azuremetricsextcould be created with its own private group as primary, while the service actually runs withazuremonitoragentas its group. In environments that manage/etc/passwd, this caused persistent primary GID mismatches, repeated account updates, and noisy security/config-management alerts.Bug
The setup path used
useraddwithout-g, which let the system fall back to the default user-private-group behavior. On machines where a pre-existingazuremetricsextgroup already existed, useradd failed instead of creating the user with the intended service group.At the same time, the systemd unit runs ME as:
So the account creation logic and the service runtime identity were inconsistent.
Fix
azuremetricsextwithazuremonitoragentas its primary group.usermod -gwhen the user already has the expected primary group.himdsto runtimeSupplementaryGroups=in the systemd unit instead of persisting it in/etc/group.Result
useradd: group azuremetricsext exists ... use -gfailure.Validation
Validating in AMA Linux VM