Export Azure App Service Certificate as .pfx on Mac - azure

What is the easiest way to export an Azure App Service Certificate on Mac?
All results seem to point to Powershell - I have attempted to install Powershell on Mac via PowerShell Core, though I have experienced a large amount of authentication issues, namely with the Connect-AzureRmAccount command:
Connect-AzureRmAccount : Object reference not set to an instance of an object.
At line:1 char:1
+ Connect-AzureRmAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-AzureRmAccount], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Profile.ConnectAzureRmAccountCommand
Help would be appreciated.

Answering my own question.
1. Install Powershell with brew:
brew cask install powershell
2. Verify that your install is working properly:
pwsh
3. Execute the powershell script found here: https://blogs.msdn.microsoft.com/benjaminperkins/2017/04/12/export-an-azure-app-service-certificate-pfx-powershell/

Related

How to read who created lists on Sharepoint

I am new to Sharepoint, but I need to get a list of files from my Sharepoint site and determine who created the file. Is there a way to do this? I have been looking online for the last couple of hours and found some Power shell scripts. But when I run them I get errors.
First thing I did was install Microsoft.Online.Sharepoint.Powershell
I ran the script :
Get-Module -Name Microsoft.Online.SharePoint.PowerShell -ListAvailable | Select Name,Version
I got
Name Version
Microsoft.Online.SharePoint.PowerShell 16.0.21909.0
So it looks like I installed it correctly.
I ran the script
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
I got the error
Install-Module : The 'Install-Module' command was found in the module 'PowerShellGet', but the module could not be
loaded. For more information, run 'Import-Module PowerShellGet'.
At line:1 char:1
Install-Module -Name Microsoft.Online.SharePoint.PowerShell
+ CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Is there something else I need to load ? Or this is the wrong direction to get the information?
You could run the following Powershell commands: Set-ExecutionPolicy Unrestricted then try to run Install-Module -Name Microsoft.Online.SharePoint.PowerShell again.
For Reference: Set-ExecutionPolicy.

The term 'New-AzureServiceProject' is not recognized as the name of a cmdlet

Description
Hi We need to deploy a TCP server with a "different known" port so we selected an azure cloud service. My team has different OS so we need to deploy with powershell code. We also enabled the "Enable-AzureRmAlias" command to avoid errors. In both operating systems we got the same error.
The term 'New-AzureServiceProject' is not recognized as the name of a cmdlet
Steps to reproduce
We tried the same steps in MACOS and a windows 7 machine and followed the azure tutorial:
https://learn.microsoft.com/en-us/azure/cloud-services/cloud-services-nodejs-develop-deploy-express-app
Everything works fine until the New-AzureServiceProject expressapp command.
Environment data
In both machines we got:
$PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
6 2 1
Get-InstalledModule -Name Az -AllVersions | select Name,Version
Name Version
Az 2.4.0 Az 2.3.2
az --version
azure-cli 2.0.67 *
Error output
New-AzureServiceProject : The term 'New-AzureServiceProject' 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
+ New-AzureServiceProject helloworld
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-AzureServiceProject:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
New-AzureServiceProject is using the Azure module, this command is working well on my windows 10. I have PSVersion 5.1.17763.503.
To avoid this, you must make sure that you've got the Azure module 5.3.0+ install and NO other older version. Once that's installed, force installs the Az module again. You could follow this to migrate existing scripts to Az and more details from this SO question about Az / AzureRM / Legacy Azure Powershell Conflicts

Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' is not recognized as the name of a cmdlet, function, script file, or operable program

I am stuck in a problem in Azure PowerShell. I am not able to connect to AzureRM account. It's showing this error:
Connect-AzureRMAccount : The term 'Connect-AzureRMAccount' 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-AzureRMAccount
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-AzureRMAccount:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I'm doing this in Mac OS . Firstly I've installed the PowerShell using: brew cask install PowerShell.
Then I've done the following:
Install-Module AzureRM -AllowClobber -Scope CurrentUser.
Install-Module Azure.
Install-Module AzureRM.
Import-Module AzureRM.
Connect-AzureRMAccount (It's Showing me the above Error).
I am expecting step 5 to give me the sign in pop up. Please Help
The AzureRM module isn't available on macOS. You will need the Az module. It has tons of parity and an option for enabling compatible aliases (Enable-AzureRmAlias):
https://azure.microsoft.com/en-us/blog/azure-powershell-cross-platform-az-module-replacing-azurerm/
Keep in mind that this module is the future, in general (Windows, macOS, and Linux... as well in Azure Cloud Shell).
The following cmdlets are useful:
Install-Module -Name Az -AllowClobber
Import-Module Az
Connect-AzAccount

Cannot create Windows shortcuts in PowerShell on Linux

I want to use scripts to create shortcuts under the Windows operating system (.lnk).
In the Windows environment, I chose PowerShell, wrote the script, successfully created .lnk.
$shell = New-Object -ComObject WScript.Shell
$desktop = [System.Environment]::GetFolderPath('Desktop')
$shortcut = $shell.CreateShortcut("$desktop\clickme.lnk")
$shortcut.TargetPath = "C:\Users\scc\Desktop\linkfolder"
$shortcut.IconLocation = "shell32.dll,004"
$shortcut.Save()
But my online running environment is Linux.
Fortunately, I found that PowerShell in 2016 on a multi-platform transplant, yes, it can support Linux. I found it, downloaded, and installed. Under Linux, in the PowerShell command window I can run some basic commands.
There was a run-time error!
When I run the first line of code:
$shell = New-Object -ComObject WScript.Shell
The error message is:
New-Object : Unable to load DLL 'api-ms-win-core-com-l1-1-0.dll': The specified
module or one of its dependencies could not be found.
(Exception from HRESULT: 0x8007007E)
At line:1 char:10
+ $shell = New-Object -ComObject WScript.Shell
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-Object], DllNotFoundException
+ FullyQualifiedErrorId : System.DllNotFoundException,Microsoft.PowerShell.Commands.NewObjectCommand
According to the prompt, it seems that the lack of WScript-related modules. Missing DLL file.
My requirement is to run Java programs under Linux to create shortcuts in Windows format. (Stored in the network disk, the file system for the btrfs, and can provide SMB \ AFP \ NFS \ FTP these file services)
Yes, this demand seems to be strange, if you have a new solution ideas and ideas, please tell me or discuss with me.
I have a bold idea: can I use the SMB protocol to create an .lnk file?
You can use the below to create Windows Shortcuts in Linux:
MSLink
It is having both bash version and C source.
Refer this also:
Produce-lnk-file-on-gnu-linux-to-transfer-to-windows

Trouble installing Azure RM Ubuntu 16.04

I am using Ubuntu 16.04 with an elevated PS shell. The appropriate version of PowershellGet is installed.
https://learn.microsoft.com/en-us/powershell/azure/install-azurerm-ps?view=azurermps-4.1.0
When trying to follow the above directions I receive this error below:
PackageManagement\Install-Package : Package 'AzureRM.profile' failed to be installed because: /tmp/1323106488/AzureRM.profile/AzureRM.profile.nuspec At /opt/microsoft/powershell/6.0.0alpha.14/Modules/PowerShellGet/1.1.2.0/PSModule.psm1:1809 char:21 + ... $null = PackageManagement\Install-Package #PSBoundParameters + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidResult: (AzureRM.profile:String) [Install-Package], Exception + FullyQualifiedErrorId : Package '{0}' failed to be installed because: {1},Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Did I miss a step?
basically you are applying a windows tutorial to a ubuntu box and wondering why that doesn't work...
Install-Package -Name AzureRM.NetCore.Preview -Source https://www.powershellgallery.com/api/v2 -ProviderName NuGet -ExcludeVersion -Destination <Folder you want this to be installed>
you can follow this article to install AzureRM.Profile and AzureRm.Resources (i think those are the only ones ported as of now).
There was an experimental docker image with some other modules laying around, I can't seem to find it now
docker run -it twitchax/azure-powershell-core
here you are; this one has:
AzureRM.Compute.Netcore
AzureRM.Network.Netcore
AzureRM.Profile.Netcore
AzureRM.Resources.Netcore
AzureRM.Storage.Netcore
AzureRM.Tags.Netcore
AzureRM.Websites.Netcore

Resources