Change the paramaters that Visual Studio uses when running Deploy-AzureResourceGroup - powershell

I'm using Visual Studio 2017 to deploy resources to a resource group in Azure. This runs the 'Deploy-AzureResourceGroup.ps1" powershell script that is automatically generated. I wanted to remove a couple of the parameters that I do not need (i.e. DSCSourceFolder) from this powershell script. When I try to deploy, it throws an error message saying that it cannot find the parameter that I removed.
A parameter cannot be found that matches parameter name 'DSCSourceFolder'.
Is there any way to change the default parameters that Visual Studio uses when starting the Deploy-AzureResourceGroup.ps1 powershell script?

The command the VS uses to invoke the script is not configurable... you can of course ignore them but not change or remove them without affecting the UI in VS.
If you just run the script from PowerShell, then you can do whatever you want to it.
All that said, I'm interested in your scenario - i.e. why the desire to customize?

Related

How to locally debug a Queue triggered Azure Function wirtten in PowerShell with Visual Studio Code?

I would like to have some information about how to do such a thing.
I've installed the plugins for Visual Studio Code, I've imported the modules at the beginning of my PowerShell script, I've fill the requirements.psd1 with the appropriate module names.
Still, when I launch the command, nothing happen.
My goal is to create a team in Microsoft Teams using PowerShell.
I put a breakpoint and it is never reached.
What am I doing wrong ?
Thank you.
Summarize the comments above as below for other communities reference:
Just wait for some minutes until the powershell terminal displays some relevent information. Otherwise that means it is importing/installing modules. We can also refer to the post provided by Mathias in the comments.

PowerShell script builds the wrong path in TFS2017

I am adding a PowerShell script to run in my build to get the Version Number for the build. When I use the builder(Box with ...) to get the file, it takes me to my TFS Project and I work my way down to the file. When the build definition runs it fails at that step, because it cant find my script.
What it has done is prepended the local Servers work directory to the front of the Path it had me choose.
I feel this is a Bug or how am I suppose to get the most current copy of a script in TFS when the Build Definition runs.
Tried with a simple powershell script on my side, but couldn't reproduce your issue, the script is working.
Only add one step in build, and map to $/teamproject in Repositity, then select the script:
To narrow down the issue, you could create a new pipeline with only one task-Powershell, check what will happen.
If you still get error, please share detail logs with system.debug=true enable.
Also take a look at this tutorial about how to use powershell fetch/change build number, which may helps-- Use a PowerShell script to customize your build pipeline
Update
According to your error info, you are lacking of the definition.
Please make sure you have specified the value in options--build number format
$(BuildDefinitionName)_$(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
Then it should run without any problem:

Get Build Version in automated build deployment using TFS

I am deploying web application to azure using TFS CI automated build deployment.
In our config maintain build version like 2014.05.19.1 which is $(Date).$(rev) format.
All I want to update config each time build is deployed.For that I am passing value to 'BuildVersion' parameter in template to powershell script which actually performs publishing to azure.
I tried using $(Date:yyyyMMdd)$(Rev:.r) but it is considered string as it is.
I want to get current build version just like IBuildDetail.BuildNumber
within template.
My question is how to get the build version?
If you are using Invoke Process, instead of passing value for BuildVersion parameter you can directly use 'BuildDetail.BuildNumber' in parameters for process like
String.Format("-BuildNumber ""{0}""",BuildDetail.BuildNumber)
This would give the required build number.
If your PowerShell script is being executed from your TFS build, it should have access to the environment variables specific to the TFS context of the build. If that is the case, you actually don't need to pass the $(BuildVersion) parameter to the script, as it already is accessible to the PS script in the $env:TF_BUILD_BUILDNUMBER environment variable. Try testing something like $env:TF_BUILD_BUILDNUMBER | Out-File "D:\Dev\BuildNumber.txt" in your script. You should hopefully see the file containing your build number after running your build.
(I am assuming you are using a relatively new build process template...one that contains the "Post-Build script path" parameter, such as TfvcTemplate.12.xaml)
Hope this is helpful.
I would recommend that you use the right tool for the right job. The build system, is really only for building (compile & test). We have been using it for other things for years coz we did not have another integrated solution. However Microsoft recently bought InRelease and rebranded as Release Management for Visual Studio 2013. I have successfully integrated this with TFS 2012 as well.

Setting up 1-click Install for custom Powershell provider

I've created a custom Powershell provider. However, currently there are a few steps people have to do to get it working on a user's computer:
configure Powershell to run against .Net 4 (add a config file in c:\Windows\System32\WindowsPowerShell\v1.0)
add a custom formatter (to the System32 for c:\Windows\System32\WindowsPowerShell\v1.0).
register the snap-in.
The remainder setup steps are completed by a custom powershell script.
I was wondering if anyone could share their experiences on simplifying the process. Ideally I'd like people to run from a single command (ideally a CommandLet that's completes all the above steps.
Has anyone got any Links or Suggestions or Best Practise they could share?
I've found the following snippets that may help.
VS Command prompt variables
For the Visual Studio Command you could try Lee Holmes' http://poshcode.org/2176 or the Powershell Communit extensions (PSCVX). Both from https://superuser.com/questions/104868/run-visual-studio-command-line-tools-in-windows-powershell.
After that it's just the formatter and/or registering the snap-in.
Configure Powershell to use .Net4
How can I run PowerShell with the .NET 4 runtime?

Using multiple custom dictionaries using FxCop command line arguments

I had set up fxcop Custom Dictionaries for several projects in Visual Studio. However when it comes to running FxCop as part of our build process (using NAnt), we ran into trouble.
We currently have FxCop set up to run with the command line arguments /project:ProjectPath as well as /file:OutputPath/*.dll, and it seems to be respecting those arguments.
How can I tell FxCop to respect what I've set up in my .csproj files; through either the command line, or in a .fxcop project file?
Ideally, we don't want to have to change anything any time we add a new project or a new CustomDictionary.xml file. Hopefully, it would find all the custom dictionaries by itself.
The task that executes FxCopCmd in MSBuild actually fetches the codeanalysisdictionary.xml file location from the .csproj. So if you want to execute fxcop yourself, you'd either have to run it through MSBuild or duplicate the behavior into your nant task.