# Buggy code
def acr_update_set(client, registry_name, resource_group_name=None, parameters=None):
    """Sets the properties of the specified container registry.
    :param str registry_name: The name of container registry
    :param str resource_group_name: The name of resource group
    :param RegistryUpdateParameters parameters: The registry update parameters object
    """
    registry, resource_group_name = get_registry_by_name(
        registry_name, resource_group_name
    )

    if registry.sku.tier == SkuTier.managed.value:
        if parameters.sku is not None:
            validate_sku_update(parameters.sku)
        if parameters.storage_account is not None:
            parameters.storage_account = None
            logger.warning(
                "The registry '%s' in '%s' SKU is a managed registry. The specified storage account will be ignored.",
                registry_name,
                registry.sku.name,
            )
        client = get_acr_service_client(MANAGED_REGISTRY_API_VERSION).registries
    elif registry.sku.tier == SkuTier.basic.value:
        if hasattr(parameters, "sku") and parameters.sku is not None:
            parameters.sku = None
            logger.warning(
                "Updating SKU is not supported for registries in Basic SKU. The specified SKU will be ignored."
            )
        if parameters.storage_account is not None:
            parameters.storage_account = ensure_storage_account_parameter(
                parameters.storage_account
            )

    return client.update(resource_group_name, registry_name, parameters)


# Traceback (AttributeError)
$ az acr repository delete -n myRegistry -u myUser -p myPass --repository myorg/myrepo

'NoneType' object has no attribute 'tier'
Traceback (most recent call last):
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/main.py", line 36, in main
cmd_result = APPLICATION.execute(args)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/core/application.py", line 212, in execute
result = expanded_arg.func(params)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 377, in __call__
return self.handler(*args, **kwargs)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 626, in _execute_command
reraise(*sys.exc_info())
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/core/commands/__init__.py", line 603, in _execute_command
result = op(client, **kwargs) if client else op(**kwargs)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/command_modules/acr/repository.py", line 281, in acr_repository_delete
registry_name, resource_group_name, DELETE_NOT_SUPPORTED)
File "/usr/lib64/az/lib/python2.7/site-packages/azure/cli/command_modules/acr/_utils.py", line 286, in managed_registry_validation
if arm_resource.sku.tier == SkuTier.basic.value:
AttributeError: 'NoneType' object has no attribute 'tier'

# Fixed code
def acr_update_set(client, registry_name, resource_group_name=None, parameters=None):
    """Sets the properties of the specified container registry.
    :param str registry_name: The name of container registry
    :param str resource_group_name: The name of resource group
    :param RegistryUpdateParameters parameters: The registry update parameters object
    """
    registry, resource_group_name = get_registry_by_name(
        registry_name, resource_group_name
    )

    validate_sku_update(registry.sku.name, parameters.sku)

    if (
        registry.sku.name in MANAGED_REGISTRY_SKU
        and parameters.storage_account is not None
    ):
        parameters.storage_account = None
        logger.warning(
            "The registry '%s' in '%s' SKU is a managed registry. The specified storage account will be ignored.",
            registry_name,
            registry.sku.name,
        )

    return client.update(resource_group_name, registry_name, parameters)