Skip to content

Commit

Permalink
{IoT} az iot hub policy renew-key: Service-side HIS renewal of IoT …
Browse files Browse the repository at this point in the history
…Hub policy keys (#30334)
  • Loading branch information
c-ryan-k authored Jan 26, 2025
1 parent eddc651 commit ac6f490
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/azure-cli/azure/cli/command_modules/iot/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
from azure.cli.command_modules.iot.shared import EndpointType, EncodingFormat, RenewKeyType, AuthenticationType, IdentityType
from azure.cli.command_modules.iot._client_factory import resource_service_factory
from azure.cli.command_modules.iot._client_factory import iot_hub_service_factory
from azure.cli.command_modules.iot._utils import open_certificate, generate_key
from azure.cli.command_modules.iot._utils import open_certificate


logger = get_logger(__name__)
Expand Down Expand Up @@ -904,9 +904,9 @@ def iot_hub_policy_key_renew(cmd, client, hub_name, policy_name, regenerate_key,
updated_policies = [p for p in policies if p.key_name.lower() != policy_name.lower()]
requested_policy = [p for p in policies if p.key_name.lower() == policy_name.lower()]
if regenerate_key == RenewKeyType.Primary.value:
requested_policy[0].primary_key = generate_key()
requested_policy[0].primary_key = None
if regenerate_key == RenewKeyType.Secondary.value:
requested_policy[0].secondary_key = generate_key()
requested_policy[0].secondary_key = None
if regenerate_key == RenewKeyType.Swap.value:
temp = requested_policy[0].primary_key
requested_policy[0].primary_key = requested_policy[0].secondary_key
Expand Down

0 comments on commit ac6f490

Please sign in to comment.