Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Invoke-AzKeyVaultKeyOperation allow plain text input for the -value parameter #24943

Closed
risksoft-atacana opened this issue May 16, 2024 · 5 comments
Assignees
Labels
Azure PS Team customer-reported feature-request This issue requires a new behavior in the product in order be resolved. issue-addressed KeyVault

Comments

@risksoft-atacana
Copy link

Description of the new feature

Hello Team,

I hava a use case where I encrypt something using a key vault key using power automate and then run an azure automation runbook via webhook and send that encrypted data. Because the value Invoke-AzKeyVaultKeyOperation requires a secure.string i cannot decrypt the payload as converting that payload to secure.string will change the payload and the decryption operation in the runbook will fail.

Proposed implementation details (optional)

Allow [string] types to -value parameter

@risksoft-atacana risksoft-atacana added feature-request This issue requires a new behavior in the product in order be resolved. needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 16, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels May 16, 2024
@risksoft-atacana
Copy link
Author

/unresolve

@microsoft-github-policy-service microsoft-github-policy-service bot added needs-team-attention This issue needs attention from Azure service team or SDK team and removed issue-addressed labels May 17, 2024
@risksoft-atacana
Copy link
Author

Hello Team,

I'm sorry if I shouldn't have reopened this but its the first time I'm using this feature request and I don't really understand how it works. You closed the request telling me that it has been address.

Does it mean that it will be implemented? If yes is there a timeline? Does it mean that the feature already exists? If yes is there a tutorial on how to use it?
Does it mean its not something up for consideration and it will not be implemented?

@BethanyZhou
Copy link
Contributor

BethanyZhou commented May 20, 2024

Hi @risksoft-atacana ,

we introduced a parameter called ByteArrayValue in Invoke-AzKeyVaultKeyOperation in Az.KeyVault >= 5.1.0, which supports operating byte array without conversion to secure string. If you have a plain text and won't/can't convert it to secure string, try following method:

# Encrypts plain text using an encryption key
$plainText = "test"
$byteArray = [system.Text.Encoding]::UTF8.GetBytes($plainText)
$encryptedData = Invoke-AzKeyVaultKeyOperation -Operation Encrypt -Algorithm RSA1_5 -VaultName test-kv -Name test-key -ByteArrayValue $byteArray
$encryptedData
# Decrypt encrypted data to plain text
$decryptedData = Invoke-AzKeyVaultKeyOperation -Operation Decrypt -Algorithm RSA1_5 -VaultName test-kv -Name test-key -ByteArrayValue $encryptedData.RawResult
$plainText = [system.Text.Encoding]::UTF8.GetString($decryptedData.RawResult)
$plainText

UTF8 may not be best way to encode plain text to bytes, you can try any way you want to use. Please let me know if you need further assistance.

@isra-fel isra-fel added issue-addressed and removed needs-team-attention This issue needs attention from Azure service team or SDK team labels May 23, 2024
Copy link
Contributor

Hi @risksoft-atacana. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve” to remove the “issue-addressed” label and continue the conversation.

Copy link
Contributor

Hi @risksoft-atacana, since you haven't asked that we "/unresolve" the issue, we'll close this out. If you believe further discussion is needed, please add a comment "/unresolve" to reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Azure PS Team customer-reported feature-request This issue requires a new behavior in the product in order be resolved. issue-addressed KeyVault
Projects
None yet
Development

No branches or pull requests

4 participants