#accesing csv file from blob storage
clear-host
$storageAccountName ="storageaccount1046"
$storageAccountKey ="ck3Fyuplbf1e2oUY7CarIQi+yYjbVvzPz2Oq7I46kLUtOEtv2fBzonBEx/25dmg48Wo7JernUJTVQejpyDwmgg=="
$context = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
$filevalue= Get-AzureStorageBlobContent -Container "blob1" -Blob "file.csv" -Context $context -Force
Write-Output $filevalue
$filePath=$filevalue.Name
Write-Output $filePath
$t = Import-Csv -Path $filePath
#print outputs
Write-Host $t
Write-Output $t
#accesing csv file from local storage
Param([Parameter(Mandatory=$True,HelpMessage='Enter the Path to your CSV')] [string]$csvpath )
$testpath = Test-Path -Path $csvpath
If (!$testpath) { clear-host write-host '***** Invalid CSV Path *****' -ErrorAction Stop }
else {
# Import the information from my CSV Import-Csv -Path "$csvPath" | ForEach-Object {
Write-Host "$($_.vmname), $($_.res_grp)"
} }
contents of csv file
VM_Name Resource_Group1
VM1 RG1 VM2 RG2 VM3 RG2 VM4 RG1 VM5 RG1
how to create .ps1 file in cloudshell
1.open cloud shell and then if you want just create file then enter
New-Item filename.ps1 example :- helloworld.ps1
if uyou want to create in particular folder the
cd $HOME/clouddrive/path name...then New-Item Filename.ps1
in order to excute .ps1 file ,type in cloudshell as .\filename.ps1