Can not connect Connect- AZAccount on power shell

SF 20 Reputation points
2023-09-08T02:09:36.8066667+00:00

I have tried to do the Connect -AzAccount,  got below error.

Connect-AzAccount : The term 'Connect-AzAccount' 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. 

At line:1 char:1 

+ Connect-AzAccount 

+ ~~~~~~~~~~~~~~~~~ 

    + CategoryInfo          : ObjectNotFound: (Connect-AzAccount:String) [], CommandNotFoundException 

    + FullyQualifiedErrorId : CommandNotFoundException



After that I did some research and tried to do the following  


 Install-Module Az

Got the below error

PS C:\Windows\system32> Install-Module Az  NuGet provider is required to continue PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet  provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or 'C:\Users\Supem Fernando\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install and import  the NuGet provider now? [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y WARNING: Unable to download from URI 'https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409' to ''. WARNING: Unable to download the list of available providers. Check your internet connection. PackageManagement\Install-PackageProvider : No match was found for the specified search criteria for the provider 'NuGet'. The package provider requires 'PackageManagement' and 'Provider' tags. Please check if the specified package has the tags. At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:7468 char:21 + ...     $null = PackageManagement\Install-PackageProvider -Name $script:N ... +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~     + CategoryInfo          : InvalidArgument: (Microsoft.Power...PackageProvider:InstallPackageProvider) [Install-Pac    kageProvider], Exception     + FullyQualifiedErrorId : NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackagePro    vider


Tried to do the recommendation of the below URL.


https://answers.microsoft.com/en-us/windows/forum/all/trying-to-install-program-using-powershell-and/4c3ac2b2-ebd4-4b2a-a673-e283827da143

But still no luck

As I am new to Power shell can someone pls help me on this.

BR

SF
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,504 questions
0 comments No comments
{count} votes

Accepted answer
  1. Lex Li (Microsoft) 5,572 Reputation points Microsoft Employee
    2023-09-08T03:36:05.9+00:00

    If you just want to try out Azure PowerShell, you can visit Azure Portal and then open Cloud Shell from the top bar, and switch from Bash to PowerShell,

    https://learn.microsoft.com/en-us/azure/cloud-shell/quickstart?tabs=azurecli

    Installing it on a Windows machine can be rather tricky if you are not familiar with PowerShell, https://learn.microsoft.com/en-us/powershell/azure/install-azps-windows?view=azps-10.2.0&tabs=powershell&pivots=windows-psgallery

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. SF 20 Reputation points
    2023-09-08T03:48:27.58+00:00

    HI Lex,

    Thank you for the reply. I was doing self study training on AZ-700 and I was in the process of creating point to site connection. In the given article it is said that we need to create self signed certificate based on the below article.

    https://learn.microsoft.com/en-us/azure/vpn-gateway/vpn-gateway-certificates-point-to-site

    "Create a self-signed root certificate

    Use the New-SelfSignedCertificate cmdlet to create a self-signed root certificate. For additional parameter information, see New-SelfSignedCertificate.

    From a computer running Windows 10 or later, or Windows Server 2016, open a Windows PowerShell console with elevated privileges.

    1. Create a self-signed root certificate. The following example creates a self-signed root certificate named 'P2SRootCert' that's automatically installed in 'Certificates-Current User\Personal\Certificates'. You can view the certificate by opening certmgr.msc, or Manage User Certificates."

    Based on point number one I felt that i need to create it on the windows machine.

    So can we use a virtual machine in azure as I thingk i am going to connect form my machine to the Azure.

    Thanks

    BR

    SF


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.