Azure module cannot be loaded in Mac OS - macos

When I try to connect to azure:
Connect-AzureRmAccount
Getting following error:
Connect-AzureRmAccount : The 'Connect-AzureRmAccount' command was found in the module 'AzureRM.Profile.Netcore', but the module could not be loaded. For more information, run 'Import-Module AzureRM.Profile.Netcore'.
But when trying to Import-Module AzureRM.Profile.Netcore, it gives me this error:
Import-Module : Could not find a part of the path '/Users/Gurnor/.local/share/powershell/Modules/AzureRM.Resources/6.4.0/Microsoft.Azure.Commands.Resources.format.ps1xml'.
Googled above error but cant find any answers? Can anyone please help?

I had a similar problem and solved it by uninstalling the AzureRM module(s) and switching to the new Az modules.
In pwsh, run: Uninstall-AzureRm
Then: Install-Module -Name Az -AllowClobber -Scope CurrentUser
If you run Enable-AzureRmAlias, most scripts using "AzureRm" cmdlets should work.
If you still have issues, try running Get-InstalledModule -Name AzureRM -AllVersions and see if you need to uninstall more modules, I think my problem was that between brew and terminal and vscode, I had several versions installed. I was only able to get things working smoothly by eliminating everything except the Az module.
https://learn.microsoft.com/en-us/powershell/module/az.accounts/uninstall-azurerm?view=azps-2.7.0
https://learn.microsoft.com/en-us/powershell/azure/install-az-ps?view=azps-2.7.0
https://learn.microsoft.com/en-us/powershell/azure/migrate-from-azurerm-to-az?view=azps-2.7.0

Related

Installing Glassfish, Wildfly using homebrew on Mac OSX

Trying to install Glassfish(Java EE App. Server) and Wildfly App Server using Homebrew .
http://macappstore.org/wildfly-as/
http://macappstore.org/glassfish/
used these above mentioned tutorials .
I got the following errors while trying to run them by typing just "glassfish" & "wildfly-as" respectively.
Output(Error):
-bash: glassfish: command not found
-bash: wildfly-as: command not found
Searched about it and I think it has something to do with $PATH. I don't understand $PATH Variable . Need help.
The issue is that there are two asadmin scripts. One at $GLASSFISH_HOME/bin and one at $GLASSFISH_HOME/glassfish/bin
Here are full instructions to get your domain up
brew update
brew install glassfish
you should see message, add that line to your .bash_profile
==> Caveats
You may want to add the following to your .bash_profile:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec
Open a new terminal then, cd $GLASSFISH_HOME/glassfish/bin
./asadmin start-domain --verbose
Browse to http://localhost:8080 for welcome page and http://localhost:4848 for admin console
I actually installed Wildfly-Application Server using homebrew but could not find a way to run it.
https://tomylab.wordpress.com/2016/07/03/how-to-install-wildfly-on-mac/
This tutorial helped me .
And for glassfish, my installation was again successful using homebrew but was not able to run it . I did figure it out when I ran the following commands.
$ cd /usr/local/opt/glassfish/libexec/bin
$ ./asadmin
asadmin> start-domain
You need to understand about the PATH variable. It is an environment variable on Unix-like operating systems, specifying a set of directories in which executable programs are located. In general, each executing process, or user session, has its own PATH setting.
So, you need to add the glassfish home path to your actual path variable.
Now, as per your problem with running the Glassfish server; try this:
export GLASSFISH_HOME=/usr/local/opt/glassfish/libexec/
export PATH=$PATH:$GLASSFISH_HOME/bin
Add it to your bash profile, if you do not want to do this everytime.

CouchDB will not install as a service on Azure Windows VM

I have previously installed CouchDB on my Azure Windows VM (Classic) without any problems using the installer setup-couchdb-1.6.1_R16B02.exe downloaded from http://couchdb.apache.org/
Today I have uninstalled the existing CouchDB installation and service with the intention of installing it again from scratch. Unfortunately, whenever I run the installer now it fails to create a windows service. More info:
I am running the installer and the command tool as Administrator
I have removed existing services using the SC command and by editing the registry (tried both methods)
I have tried creating the service after installing CouchDB using the installer by running the command:
erlsrv.exe add "Apache CouchDB" -workdir "%COUCH%\bin" -onfail
restart_always -args "-sasl errlog_type error -s couch +A 4 +W w"
-comment "Apache CouchDB 1.6.1"
This seems to create a service (which you can see in the Windows Services) but any attempt to start the service results in an error:
Windows could not start the Apache CouchDB service on Local Computer.
Error 1067: The process terminated unexpectedly.
I have tried uninstalling the CouchDB application, restarting the server, re-installing CouchDB using the installer again. No joy. Also then tried running the command to create the service. Still no joy.
When I use the command
erlsrv list
I can see the services that I've tried to add in the past. Any attempt to remove them results in the error message:
erosrv: Unable to remove service (not enough privileges?)
Error: The handle is invalid
(I am using the handle as provided by the erlsrv list command)
there are no events in the events log that I can find that explain why this is failing
How can I get CouchDB to install as a service correctly?
TL;DR: Re-install in a directory path with no spaces in it, then manually create the service.
OK so at some point in my Googling today I came across this answer which gave me the clue that I should install in a path without spaces in it. So my solution was to:
uninstall the CouchDB application via Windows Control Panel.
run the uninstall.exe in any remaining installations of CouchDB and delete those directories.
remove the existing services using the SC command.
reinstall using the installer into C:\CouchDB (note: no spaces!). Select the option to install as a service (even though this doesn't quite work).
run the command to manually create the service. Note that I'm not using the %COUCH% variable as it doesn't seem to exist on my system at this point:
erlsrv.exe add "CouchDB" -workdir "C:\CouchDB\bin" -onfail restart_always -args "-sasl errlog_type error -s couch +A 4 +W w" -comment "CouchDB 1.6.1"
This command finally managed to properly create a windows service for CouchDB that started correctly. Browsing to http://localhost:5984/_utils/ now brings me to the Futon UI. And relax!

New-SShSession command not found in jenkins powershell

I'm using Windows Jenkins and installed the windows powershell plugin. from Jenkins I'm trying to connect to Linux instance and execute some commands in linux server.
> New-SshSession -ComputerName 10.0.0.xx -Username username-Password
> jenkins#123 Invoke-SshCommand -ComputerName 10.0.0.xx -Command "cd
> docker_CIServiceApp ; unzip prod.zip -d prod/"
But getting the error message from jenkins job as
New-SshSession : The term 'New-SshSession' is not recognized as the
name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
The same command works in Windows Powershell terminal. What will be the issue?
The reason for it might be that the Jenkins was started before SSH.NET plugin was installed. It modifies the environment variable and it requires process restart. Try restarting Jenkins process. Alternatively, it might be that the module is not loaded, try loading it first: Import-Module SSH-Sessions.
So, apparently you have installed a package in Visual Studio solution. Visual studio takes care of package download for you (restoration). It gets downloaded into packages folder under your solution. When you have no Visual Studio, like when using Jenkins and MS Build directly, you have to download package manually - get nuget.exe and run nuget restore your_solution.sln, this will then download the package under "\packages". Now you will have to import module, using the "\packages" path, probably.
your error indicates tha the module isn't installed:
PS /home/thufir/powershell>
PS /home/thufir/powershell> Install-Module -Name SSHSessions
Untrusted repository
You are installing the modules from an untrusted repository. If you trust this
repository, change its InstallationPolicy value by running the Set-PSRepository
cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help
(default is "N"):Yes
PS /home/thufir/powershell>

'vagrant ssh' not working with the vagrant-multi-putty plugin

I am trying to run VirtualBox with Vagrant and the plugin vagrant-multi-putty. I am running Windows 10 and am following this guide. All the plugins and steps seem to work fine until I get to the “vagrant ssh” step. I get this error:
I did some googling and the recommended solution is usually to set the path correctly to putty.exe. You can do that like so:
set PATH=%PATH%;C:\Program Files (x86)\PuTTY
Even though the plugin seems to be installing right I can’t find the putty.exe file anywhere on my system. I tried downloading the binaries from here and manually adding them to C:\Program Files (x86)\PuTTY. Then I set the path like the example above. However, I am still getting the same error when I run "vagrant ssh".
Made the same misstake myself at first.
According to the installation instructions for https://github.com/nickryand/vagrant-multi-putty you are supposed to use:
vagrant putty
instead of "vagrant ssh"

Uninstalling heroku plugin in Windows

I attempted installing the heroku-accounts plugin on my windows machines, but got the following error when first trying to add an account:
! Resource not found
Now for all commands, I'm getting the error:
No such account:
Even when I try to uninstall the plugin I get this error, so am completely dead in the water.
Any ideas?

Resources