Passing nuget.exe restore username and password - nuget

I'm using the nuget command line to restore packages for a solution. The packages come from an internal nuget mirror which requires authentication.
I found documentation on setting the -source parameter and noticed the -username and -password parameters. It seems the last two parameters are only applicable for adding a source to a config file.
Does anyone know if there is in fact a way of just passing the username and password for a source via the command line only i.e negating the need for a config altogether?
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-add-source
Thanks!

As far as I can tell, according to the docs, there is currently no way to do this. I agree that it would be a really helpful feature.

Related

How to list all Power Platform solutions using PowerShell or Microsoft Graph API?

I'm looking to for way to get an entire Power Plateform list of solutions. The aim is to export all the solutions with their properties (i.e. Name, id, date of creation, etc).
As you know, solutions can contains, Power Apps application, Power Automate flows, environment variables and so on.
I already know that Power Apps applications (canvas apps) can be retreived by using this command line:
Get-AdminPowerApp
And Flows can be retreived by using this one:
Get-AdminFlow -EnvironmentName "env"
We can found command line to get environements, connections, connectors, etc.
Is there a command line that look like the following one ?
Get-AdminPowerAppsSolution -Environment "env"
Thank you all.
To be able to get solutions with PowerShell an additional PowerShell module is required and can be install by typing the following command-line:
Install-Module Microsoft.Xrm.Data.Powershell
Once the module is installed, a connection to crm online is required :
Connect-CrmOnlineDiscovery -InteractiveMode
The InteractiveMode option prompt a modal to allow the user to enter his credentals. Connection can also be acheived by creating credental manually and then pass it as a parameter:
$creds = Get-Credential
Connect-CrmOnlineDiscovery -Credential $creds
Which prompt a login window as well, but once the credental is set, it can be reused for further calls.
And finally, a lasts commands as follow :
$records = Get-CrmRecords -EntityLogicalName solution
$records.crmRecords
The crmRecords attributes contains all the solution for the selected environment with the following properties :
ReturnProperty_EntityName
solutionid
solutionid_Property
ReturnProperty_Id
EntityReference
original
logicalname
Finding all apps across all environments to which you have admin access can be done with the following command:
Get-AdminPowerApp
More information about this command can be found on Microsoft docs here: https://learn.microsoft.com/en-us/powershell/module/microsoft.powerapps.administration.powershell/get-adminpowerapp?view=pa-ps-latest
You can get PowerApps Solutions by installing the PowerApps CLI.
Look at the Solution export command.
Example:
pac solution export --path c:\Users\Documents\Solution.zip --name SampleComponentSolution --managed true --targetversion 10.0.03 --include general

Run Powershell script from Git in Jenkins

I'm trying to run a powershell script stored in AWS CodeCommit in Jenkins but without success.
I've tested all the possible solutions I can think of.
Is there any tested way that I can follow to do this?
Regards,
For the envirionment I am in I have had to do it the following way to get it to work.
Build Step - Windows Powershell with the following code
$File_Path_Name = $ENV:WORKSPACE + "\Folder\ScriptName.ps1"
Powershell -File $File_Path_Name
You will also need to make sure you have Git configured properly under Source Code Management. Repository URL, Credentials, and the Branch. Also need to make sure the credentials used have the proper access to GitHub(in my case)

Run Publish-AzureRmVMDscConfiguration without logging in

How can I pack a configuration archive without logging in? I want to run this command in an automation context:
Publish-AzureRmVMDscConfiguration -Force -ConfigurationPath .\AppServer.ps1 -ConfigurationArchivePath .\AppServer.ps1.zip
There are no calls out to the network, I'm not performing any subscription operations that require authorization, I just want it to make me a nice zip file with the cmdlet. However, when I try, it fails:
Publish-AzureRmVMDscConfiguration : Run Login-AzureRmAccount to login.
This seems silly to me but I went ahead and checked Get-Help. I can't find anything that looks helpful though. How can I pack up my DSC configuration without having to run Login-AzureRmAccount?
I suspect this is a "design limitation" - you might start by filing an issue here: https://github.com/Azure/azure-powershell
As a workaround, depending on the "sophistication" of your DSC config, you can just create a zip file yourself. If you have additional/non-default modules or resources, you'd need to put those in the archive as well (which is what the cmdlet helps with)...

Passing parameters to Boxstarter via Install-BoxstarterPackage

When invoking a BoxStarter package, I use a powershell line such as:
Install-BoxstarterPackage -Package $script
I would like to pass some command line arguments into the package, but this does not seem to be supported.
Some relevant discussion:
https://github.com/mwrock/boxstarter/issues/5
An issue about a fix that does not seem to exist:
https://github.com/mwrock/boxstarter/issues/66
I ended up "cheating" and setting an environment variable before the package invocation like so:
$env:BoxstarterFoo = "Some Value"
Install-BoxstarterPackage -Package $script
Which makes $env:BoxstarterFoo available from within the package. This does not seem optimal. Is there a better way to pass information from an installation script into a boxstarter install right now, or is a workaround such as using environment variables required?
I'm afraid that is likely the best workaround currently available.

Reference to undefined variable USER (aptana, egit) [duplicate]

When i try to put something on a git server it's givin' me an error:
"Reference to undefined variable USER"
In bash: echo $USER giving me correct answer.
What could it be?
It's eclipse with aptana-3 plugin (a whole pack)
A bash session might have the correct environment variable set.
But the native OS session might not (like a DOS session on Windows for instance).
Can you launch your aptana from a session which has just before set the correct value for USER?
If it still fails (like in this thread), try also to set the correct value for $HOME.
Update: Tracked down the issue. Looks like Eclipse is biting on ENV values that contain "${" in the value. A user was changing his command prompt to incude his username, hostname and pwd. After he commented it out of his .profile, it avoided the issue. As a result I added a bugfix to fix that in our development stream that should get into our next release.
--
Looks like a duplicate of https://aptana.lighthouseapp.com/projects/35272/tickets/1867-git-push-has-encountered-a-problem
I'm not able to replicate the issue, but if you could provide some more details on that ticket I can take a look, since I wrote all of our git support. It's likely that somehow something like $USER is sneaking into the git executable path, and when passed along to the launching infrastructure, it tries to interpret it as an eclipse launching variable (as opposed to a ENV var) that it can't resolve.