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

Assigning "Monitoring Metrics Publisher" role to AKS fails

Open martinvelos opened this issue 7 years ago • 2 comments

Trying to enable advanced aks monitoring according to https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-update-metrics#upgrade-per-cluster-using-azure-cli was very poor on pointing on the right format. When I gave URL from Azure portal for try, the az failed.

Command Name az role assignment create

Errors:

The command failed with an unexpected error. Here is the traceback:


Cannot deserialize content-type: text/html
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python2.7/site-packages/knack/cli.py", line 206, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in execute
    raise ex
DeserializationError: Cannot deserialize content-type: text/html

To Reproduce:

  • az role assignment create --assignee someClientId --scope https://portal.azure.com/#@matejpilatelostech.onmicrosoft.com/resource/su bscriptions/37dccafa-b44f-41e6-b945-fd37e3790d1c/resourceGroups/mv-testProbes/providers/Microsoft.ContainerService/managedClusters/aks-cluster --role "Monitoring Metrics Publisher"

Environment Summary

Linux-5.2.11-200.fc30.x86_64-x86_64-with-fedora-30-Thirty
Python 2.7.16
Shell: bash

azure-cli 2.0.72 *

Extensions:
interactive 0.4.3

Additional Context

martinvelos avatar Oct 02 '19 16:10 martinvelos

Similar to: https://github.com/Azure/azure-cli/issues/10127#issuecomment-519095585

A scope is simply an Azure resource ID. In this case, it should be /subscriptions/37dccafa-b44f-41e6-b945-fd37e3790d1c/resourceGroups/mv-testProbes/providers/Microsoft.ContainerService/managedClusters/aks-cluster

You may check the help with

> az role assignment create -h

Arguments
    ...
    --scope                   : Scope at which the role assignment or definition applies to, e.g.,
                                /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333,
                                /subscriptions/0b1f6471-1bf0-4dda-
                                aec3-111122223333/resourceGroups/myGroup, or
                                /subscriptions/0b1f6471-1bf0-4dda-aec3-111122223333/resourceGroups/m
                                yGroup/providers/Microsoft.Compute/virtualMachines/myVM.

jiasli avatar Oct 08 '19 05:10 jiasli

@jiasli add to S163.

yonzhan avatar Nov 27 '19 13:11 yonzhan