Azure Stack Hub Event Hub Secrets Rotation | Microsoft AZ-600 Exam

Rotate Secrets for Azure Stack Hub Event Hub | AZ-600 Exam

Question

For the Event Hub on Azure Stack Hub, you need to rotate the external and internal secrets.

You have imported your new certificate to Key Vault which is needed for the rotation process using the necessary cmdlet.

As a next step, which cmdlet would you use to rotate the secrets?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D. E.

Correct Answer: C

Rotating the secrets involves two main steps as given below:

Firstly, Set-AzsProductSecret cmdlet is used to import the new certificate to Key Vault, which will be utilized by the rotation procedure.

Also, change the variable placeholder values accordingly before you run the script.

Then, Invoke-AzsProductRotateSecretsAction cmdlet is used to rotate the secrets(internal as well as external)

Option A is incorrect.

Set-AzsProductSecret cmdlet is used to import the new certificate to Key Vault, the step which you have already completed in the scenario.

Option B is incorrect.

The right command to rotate the secrets is Invoke-AzsProductRotateSecretsAction, not Invoke-AzsRotateSecret.

Option C is correct.

Invoke-AzsProductRotateSecretsAction is the right command that needs to be used to rotate the secrets.

Option D is incorrect.

There is no cmdlet like Invoke-AzsProductRotateSecret in PowerShell.

Rather, it is Invoke-AzsProductRotateSecretsAction.

Option E is incorrect.

Get-AzsProductSecret -PackageId cmdlet helps in retrieving the list of secret types that are used by the resource provider.

To know more about rotating the secrets, please visit the below-given link:

To rotate the secrets for the Event Hub on Azure Stack Hub after importing a new certificate to Key Vault, you would use the Invoke-AzsRotateSecret cmdlet.

Here's an overview of the steps to rotate the secrets:

  1. Import the new certificate to Key Vault. This can be done using the Azure Portal, PowerShell, or the Azure CLI.

  2. Install the Azure Stack Hub PowerShell module on your computer, if you haven't already.

  3. Open a PowerShell session and connect to your Azure Stack Hub instance using the Connect-AzsAccount cmdlet.

  4. Use the Set-AzsProductSecret cmdlet to set the external and internal secrets for the Event Hub to the values that are currently stored in Key Vault. For example:

    bash
    $externalSecret = Get-AzKeyVaultSecret -VaultName "MyKeyVault" -Name "MyExternalSecret" $internalSecret = Get-AzKeyVaultSecret -VaultName "MyKeyVault" -Name "MyInternalSecret" Set-AzsProductSecret -Name "Microsoft.AzureStack.EventHub" -ExternalSecret $externalSecret.SecretValueText -InternalSecret $internalSecret.SecretValueText
  5. Use the Invoke-AzsRotateSecret cmdlet to rotate the secrets. For example:

    python
    Invoke-AzsRotateSecret -Name "Microsoft.AzureStack.EventHub"

    This will rotate both the external and internal secrets for the Event Hub using the new certificate that was imported to Key Vault.

  6. Verify that the rotation was successful by checking the event logs for the Event Hub.

In summary, the correct answer to the question is B. Invoke-AzsRotateSecret.