Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,8 @@ def aks_enable_addons(cmd, client, resource_group_name, name, addons,
msi_auth = False
if instance.service_principal_profile.client_id == "msi":
msi_auth = True
else:
enable_msi_auth_for_monitoring = False
subscription_id = get_subscription_id(cmd.cli_ctx)

instance = _update_addons(cmd, instance, subscription_id, resource_group_name, name, addons, enable=True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2608,6 +2608,12 @@ def get_enable_msi_auth_for_monitoring(self) -> Union[bool, None]:

# read the original value passed by the command
enable_msi_auth_for_monitoring = self.raw_param.get("enable_msi_auth_for_monitoring")
if (
self.mc and
self.mc.service_principal_profile and
self.mc.service_principal_profile.client_id is not None
):
return False
# try to read the property value corresponding to the parameter from the `mc` object
if (
self.mc and
Expand Down Expand Up @@ -5373,9 +5379,9 @@ def build_monitoring_addon_profile(self) -> ManagedClusterAddonProfile:
enabled=True,
config={
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID: self.context.get_workspace_resource_id(),
CONST_MONITORING_USING_AAD_MSI_AUTH: "True"
CONST_MONITORING_USING_AAD_MSI_AUTH: "true"
if self.context.get_enable_msi_auth_for_monitoring()
else "False",
else "false",
},
)
# post-process, create a deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7494,8 +7494,7 @@ def test_aks_create_with_monitoring_legacy_auth(self, resource_group, resource_g
'--ssh-key-value={ssh_key_value} '
response = self.cmd(create_cmd, checks=[
self.check('addonProfiles.omsagent.enabled', True),
self.exists('addonProfiles.omsagent.config.logAnalyticsWorkspaceResourceID'),
self.check('addonProfiles.omsagent.config.useAADAuth', 'false')
self.exists('addonProfiles.omsagent.config.logAnalyticsWorkspaceResourceID')
]).get_output_in_json()

# make sure a DCR was not created
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,7 @@ def test_get_enable_msi_auth_for_monitoring(self):
addon_profiles_1 = {
CONST_MONITORING_ADDON_NAME: self.models.ManagedClusterAddonProfile(
enabled=True,
config={CONST_MONITORING_USING_AAD_MSI_AUTH: "True"},
config={CONST_MONITORING_USING_AAD_MSI_AUTH: "true"},
)
}
mc = self.models.ManagedCluster(location="test_location", addon_profiles=addon_profiles_1)
Expand Down Expand Up @@ -6016,7 +6016,7 @@ def test_build_monitoring_addon_profile(self):
enabled=True,
config={
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID: "/test_workspace_resource_id",
CONST_MONITORING_USING_AAD_MSI_AUTH: "False",
CONST_MONITORING_USING_AAD_MSI_AUTH: "false",
},
)
self.assertEqual(monitoring_addon_profile, ground_truth_monitoring_addon_profile)
Expand Down Expand Up @@ -6291,7 +6291,7 @@ def test_set_up_addon_profiles(self):
enabled=True,
config={
CONST_MONITORING_LOG_ANALYTICS_WORKSPACE_RESOURCE_ID: "/test_workspace_resource_id",
CONST_MONITORING_USING_AAD_MSI_AUTH: "False",
CONST_MONITORING_USING_AAD_MSI_AUTH: "false",
},
),
CONST_VIRTUAL_NODE_ADDON_NAME
Expand Down