Skip to content

Conversation

@koderjoker
Copy link
Owner

Related command
az redis create (new redis-configuration aad-enabled property)
redis access-policy
redis access-policy-assingment

Description
Adds new commands for aad feature

Testing Guide

(check help.py)

  • name: Deploying a Premium Azure Cache for Redis with Microsoft Entra Authentication configured
    text: az redis create --location westus2 --name MyRedisCache --resource-group MyResourceGroup --sku Premium --vm-size p1 --redis-configuration @"config_enable-aad.json"
    crafted: true

helps['redis access-policy'] = """
type: group
short-summary: Manage access policies for Redis Cache
"""

helps['redis access-policy create'] = """
type: group
short-summary: Adds an access policy to the Redis Cache
long-summary: Usage example - az redis access-policy create -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy --permissions "+get +hget"
"""

helps['redis access-policy update'] = """
type: group
short-summary: Updates an access policy of the Redis Cache
long-summary: Usage example - az redis access-policy update -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy --permissions "+get +hget"
"""

helps['redis access-policy delete'] = """
type: group
short-summary: Deletes an access policy from the Redis Cache
long-summary: Usage example - az redis access-policy delete -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy
"""

helps['redis access-policy show'] = """
type: group
short-summary: Gets the detailed information about an access policy of the Redis Cache
long-summary: Usage example - az redis access-policy show -g testResourceGroup -n testCacheName --access-policy-name testAccessPolicy
"""

helps['redis access-policy list'] = """
type: group
short-summary: Gets the list of access policies associated with the Redis Cache
long-summary: Usage example - az redis access-policy list -g testResourceGroup -n testCacheName
"""

helps['redis access-policy-assignment'] = """
type: group
short-summary: Manage access policy assignments for Redis Cache
"""

helps['redis access-policy-assignment create'] = """
type: group
short-summary: Adds an access policy assignment to the Redis Cache
long-summary: Usage example - az redis access-policy-assignment create -g testResourceGroup -n testCacheName --object-id 932b5c60-66e4-4fbf-b8b0-xxxxxxxxxxxx --object-id-alias testAlias --access-policy-name testAccessPolicy --access-policy-assignment testAccessPolicyAssignment
"""

helps['redis access-policy-assignment update'] = """
type: group
short-summary: Updates an access policy assignment of the Redis Cache
long-summary: Usage example - az redis access-policy-assignment update -g testResourceGroup -n testCacheName --object-id 932b5c60-66e4-4fbf-b8b0-xxxxxxxxxxxx --object-id-alias testAlias --access-policy-name testAccessPolicy --access-policy-assignment testAccessPolicyAssignment
"""

helps['redis access-policy-assignment delete'] = """
type: group
short-summary: Deletes an access policy assignment from the Redis Cache
long-summary: Usage example - az redis access-policy-assignment delete -g testResourceGroup -n testCacheName --access-policy-assignment testAccessPolicyAssignment
"""

helps['redis access-policy-assignment show'] = """
type: group
short-summary: Gets the detailed information about an access policy assignment of the Redis Cache
long-summary: Usage example - az redis access-policy-assignment show -g testResourceGroup -n testCacheName --access-policy-assignment testAccessPolicyAssignment
"""

helps['redis access-policy-assignment list'] = """
type: group
short-summary: Gets the list of access policy assignments associated with the Redis Cache
long-summary: Usage example - az redis access-policy-assignment list -g testResourceGroup -n testCacheName
"""


This checklist is used to make sure that common guidelines for a pull request are followed.

@koderjoker
Copy link
Owner Author

Fix needed for tearing down unit test for az redis update (which doesn't return LRO result by design)
image

@koderjoker
Copy link
Owner Author

Part in test causing the issue:

        # Disable aad on cache
        self.cmd('az redis update -n {name} -g {rg} --set redisConfiguration.aadEnabled=false')
        time.sleep()
        result = self.cmd('az redis show -n {name} -g {rg}').get_output_in_json()

        # Verify cache is aad disabled
        print(result)
        if self.is_live:
            while result['provisioningState'] == 'ConfiguringAAD':
                result = self.cmd('az redis show -n {name} -g {rg}').get_output_in_json()
                time.sleep(1)
        print(result)
        self.assertTrue(result['provisioningState'] == 'Succeeded')
        self.assertTrue(result['redisConfiguration']['aadEnabled'] == "False")

def cli_redis_access_policy_create(client, resource_group_name, cache_name, access_policy_name, permissions):
from azure.mgmt.redis.models import RedisCacheAccessPolicy
param = RedisCacheAccessPolicy(permissions=permissions)
return client.begin_create_update(resource_group_name, cache_name, access_policy_name, param)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return client.begin_create_update(resource_group_name, cache_name, access_policy_name, param)
return client.begin_create_update(resource_group_name, cache_name, access_policy_name, param).result()

Try this for long running operation

Copy link
Owner Author

@koderjoker koderjoker Nov 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@evelyn-ys I had already tried that, but the issue lies with this section of the test

        self.cmd('az redis update -n {name} -g {rg} --set redisConfiguration.aadEnabled=false')
        result = self.cmd('az redis show -n {name} -g {rg}').get_output_in_json()

@koderjoker koderjoker merged commit 0b40afe into kj/release_2023-08-01 Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants