Azure KeyVault: Retrieve secrets and their values using PowerShell and save in Excel file
Azure KeyVault: Retrieve secrets and their values
Azure KeyVault: Retrieve secrets and their values
using PowerShell
$vault_name = "keyvault-name"
# Get all secret names
$secret_names=$(az keyvault secret list --vault-name $vault_name --query [].name -o tsv)
# Loop through each secret name and get its value
foreach ($secret in $secret_names)
{
$secret_value=$(az keyvault secret show --vault-name $vault_name --name $secret --query "value")
Write-Output $secret
Write-Output $secret_value
Write-Output "-------------------------"
}
Create an Excel file using PowerShell script
Create an Excel file using PowerShell script
Here is a code to write data into Excel file and save it in a particular path.
$excel = New-Object -ComObject excel.application
#$excel.visible = $True
$workbook = $excel.Workbooks.Add()
$SheetName = "MySheet"
$uregwksht= $workbook.Worksheets.Item(1)
$uregwksht.Name = $SheetName
$row = 1
$Column = 1
$uregwksht.Cells.Item($row,$column)= "Column Title"
for ($i = 2; $i -le 5; $i++)
{
Write-Output $i
$row = $row + 1
$uregwksht.Cells.Item($row,$column)= "Abcd" + $i
}
$outputpath = "D:\test.xlsx"
$excel.displayalerts = $false
$workbook.Saveas($outputpath)
$excel.displayalerts = $true
Write-Output $("File saved on " + $outputpath )
$excel.Quit()
#ref - https://community.spiceworks.com/t/create-an-excel-file-from-within-powershell/1011485
#ref - https://chanmingman.wordpress.com/2022/10/02/powershell-write-to-excel-file/
-
Insert - Update SQL Database using Powershell Script Here is example of SQL Server database insert and update transaction using Powershel...
-
Code First Migration in ASP.Net Core Generally we create database first and then we create data model classes in project, and while we pu...
-
Git remote: HTTP Basic: Access denied and fatal Authentication Sometimes, I am facing issue with Git and getting error that - "Git...