Loading
Feature Disruption - Service Cloud Voice続きを読む
Feature degradation | Gmail Email delivery failure続きを読む

How to Convert To and From Base64 in Windows with Powershell for Kubernetes Commands Requiring "jq" and "base64"

公開日: Mar 2, 2024
ステップ

CONTENTS

You need to convert some values from or to base64 in Windows with Powershell.

For instance, you can run the follow command in Linux to decode a secret in Kubernetes:
 
kubectl get secret -n rtf persistence-gateway-creds -o json | jq -r '.persistence-gateway-creds' | base64 --decode

Here is how to do the same in Windows.

STEPS TO FOLLOW

1) Run the following in Windows:
kubectl get secret -n rtf persistence-gateway-creds -o json
2) Copy the base64 text from above output. Below is an example:
cG9zdGdyZXM6Ly9kYnVzZXIlNDBwZ3c6dGVzdHBhc3N3b3JkQHBndy5wb3N0Z3Jlcy5kYXRhYmFzZS5henVyZS5jb206NTQzMi9wZ3c/c3NsbW9kZT1yZXF1aXJlCg==

TO DECODE:

3) Run the following command to decode in Powershell:
 
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String('<base64 encoded string here>'))

For example:
 
[Text.Encoding]::Utf8.GetString([Convert]::FromBase64String('cG9zdGdyZXM6Ly9kYnVzZXIlNDBwZ3c6dGVzdHBhc3N3b3JkQHBndy5wb3N0Z3Jlcy5kYXRhYmFzZS5henVyZS5jb206NTQzMi9wZ3c/c3NsbW9kZT1yZXF1aXJlCg=='))
4) You should see the following:
postgres://dbuser%40pgw:testpassword@pgw.postgres.database.azure.com:5432/pgw?sslmode=require

TO ENCODE:

5) To encode the string, run the following command:
 
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('<plaintext string here>'))

For example:
 
[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes('postgres://dbuser%40pgw:testpassword@pgw.postgres.database.azure.com:5432/pgw?sslmode=require'))

6) You should see the following:
 
cG9zdGdyZXM6Ly9kYnVzZXIlNDBwZ3c6dGVzdHBhc3N3b3JkQHBndy5wb3N0Z3Jlcy5kYXRhYmFzZS5henVyZS5jb206NTQzMi9wZ3c/c3NsbW9kZT1yZXF1aXJlCg==






 
ナレッジ記事番号

001116439

 
読み込み中
Salesforce Help | Article