Forum Discussion

dmarquesgn's avatar
dmarquesgn
Iron Contributor
Apr 24, 2023

Password management for Powershell scripts

Hi,

I have some Powershell scripts to manage some security tasks, and I always send the results of the script over by email.

The problem I'm facing now is that when I need to change my email password, I need to go to each script individually and change it, what is not the best approach I'm sure.

What's the best practices to solve this issue and have a centralized password, and I only need to change it on 1 place?
Thanks

3 Replies

  • AndySvints's avatar
    AndySvints
    Iron Contributor

    Hello dmarquesgn,

    Please look into Microsoft.PowerShell.SecretManagement module. 

     

    You can use it to store your secrets in Local store, as well as in othe vaults ( Azure Key is supported).

     

    Use Register-SecretVault to register your Azure Key vault.

    $params = @{
        Name = 'Azure'
        ModuleName = 'Az.KeyVault'
        VaultParameters = @{
            AZKVaultName = 'MyAzureKeyVault'
            SubscriptionId = (Get-AzContext).Subscription.Id
        }
        DefaultVault = $true
    }
    Register-SecretVault @params

    Hope that helps.

    • dmarquesgn's avatar
      dmarquesgn
      Iron Contributor
      Hi,
      For me I think that would be a viable solution. Do you have any link where I can see how can I do that?
      Thanks

Resources