Asked by:
Create file in a azure storage account location/shared folder? Path questions on my code

Question
-
Im new to powershell and runbooks, im currently trying to understand why my code works or basically where is the file stored i do understand my path but i dont see how i can see the files in a azure storage account. I guess my code PS code needs to actually upload it to a shared folder or blob but im not sure how to do this.
What im trying to do is create a pnp template of a site and upload it to a sharepoint library. My code works but i dont really know how path c:\ can work and what i should change to actually upload it to a shared folder or blob instead. I do the converting from xml to pnp because for some reason if i create a pnp file directly it fails to be applied later on but xml files works and converting xml to pnp works.
param ( [Parameter(Mandatory=$true)] [string]$Url, [Parameter(Mandatory=$true)] [string]$TemplateName, [Parameter(Mandatory=$true)] [string]$CheckInComment ) $cred = Get-AutomationPSCredential -Name xxxx Connect-PnPOnline -Url $Url -Credentials $cred Get-PnPProvisioningTemplate -Out C:\templates\MyTemplate.xml -ExcludeHandlers SiteSecurity Convert-PnPFolderToProvisioningTemplate -Out C:\templates\MyTemplate.pnp -Folder C:\templates -Force Connect-PnPOnline -Url 'https://xxxxxx/sites/TemplateStorageCenter' -Credentials $cred Add-PnPFile -Path C:\templates\MyTemplate.pnp -Folder 'Course Site Templates' -Checkout -CheckInComment $CheckInComment -NewFileName $TemplateName
- Edited by Jimmy_Work Monday, February 17, 2020 8:08 AM Sorry for formating
Friday, February 14, 2020 12:38 PM
All replies
-
Please edit your post and fix the code to display correctly.
\_(ツ)_/
Friday, February 14, 2020 12:59 PM -
Still pretty much a mess. Why can't you do the following:
The PowerShell Best Practices and Style Guide
If you make it harder for us to read your code then it will take longer to get an answer.
\_(ツ)_/
Saturday, February 15, 2020 6:26 PM -
The following is readable
param ( [Parameter(Mandatory=$true)] [string]$Url, [Parameter(Mandatory=$true)] [string]$TemplateName, [Parameter(Mandatory=$true)] [string]$CheckInComment ) $cred = Get-AutomationPSCredential -Name xxxx Connect-PnPOnline -Url $Url -Credentials $cred Get-PnPProvisioningTemplate -Out C:\templates\MyTemplate.xml -ExcludeHandlers SiteSecurity Convert-PnPFolderToProvisioningTemplate -Out C:\templates\MyTemplate.pnp -Folder C:\templates -Force Connect-PnPOnline -Url 'https://xxxxxx/sites/TemplateStorageCenter' -Credentials $cred Add-PnPFile -Path C:\templates\MyTemplate.pnp -Folder 'Course Site Templates' -Checkout -CheckInComment $CheckInComment -NewFileName $TemplateName
Your question is not understandable. What is it you mean by "blob storage"?
\_(ツ)_/
Saturday, February 15, 2020 6:31 PM -
Sorry for the bad copy and paste was in a rush, wont happen again.
With blob storage i just mean writing the file to an azure blob or even a shared storage created in azure.
I guess my questions is when i run my code it works, but i can't really browse to C:\ in my storage account or at least not in in a good way that i know of. If i was able to create the files in a azure blob or shared storage it would be easier for me to view the files.
Monday, February 17, 2020 8:10 AM -
For issues with Azure or SharePoint online you will have to post in the azure forums. All of your questions have nothing to do with scripting.
\_(ツ)_/
Monday, February 17, 2020 8:22 AM