how do I create a new azure management cache? - powershell

Now that Microsoft has completely dropped the GUI support on the management portal, they are requiring me to install and setup and use windows Azure PowerShell to create a new managed cache service. As someone with not a ton of PowerShell experience. I cannot figure out how to successfully create a new azure managed cache. Does anyone have any tips?
I did the following:
executed in PowerShell:
Add-AzureAccount
connected with login to Azure account
executed in PowerShell:
New-AzureManagedCache -Name test -Location "South Central"
and the error is:
New-AzureManagedCache : Value cannot be null.
Parameter name: managementCertificate
At line:1 char:1
+ New-AzureManagedCache -Name test-Location "South Central"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureManagedCache], ArgumentNullException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.ManagedCache.NewAzureManagedCache
What should I do to fix this issue and get a new basic cache 128mb created?

i figured it out - i needed to
get-azurepublishsettingsfile
and then
import-azurepublishsettignsfile "c:\filename.publishsettings"
and then it appears to be creating it now

With explicit sku paramater:New-AzureManagedCache -Name test -Location "South Central" -Sku Basic -Memory 128MB

Related

IIS Application Pool configured to specific User MSA Account Through Powershell

I am not sure why it's happening but I am stuck in a point when I am trying to Configure my AppPool with a Specific Account i.e. MSA or Service Account.
I am running below script in PowerShell to do the configuration:
Import-Module WebAdministration
Set-ItemProperty IIS:\AppPools\AppPool -name processModel -value #{userName="$user_name";password="$password";identitytype=3}
The problem is that whenever I put Service account details through this script the AppPool is getting stopped and When try to start the AppPool multiple time the service account is getting locked.
When I try to Configure manually in the AppPool it's working fine and works as Expected.
For Testing I tried to put my own ID credential in the above script and then its working fine as expected, but when I tried again with Service Account the result is same as above.
I tried multiple scripts to do so and result is same, in one of the script I found a strange error:
Set-ItemProperty : Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH))
At line:8 char:1
+ Set-ItemProperty IIS:\AppPools\AppPool -name processMode ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Set-ItemProperty], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.PowerShell.Commands.SetItemPropertyCommand
Can anyone help me to configure the Service Account in AppPool.

Login-AzureRmAccount Error after running the command

Getting the below error even though I've Run the Login-AzureRmAccount command and I've also selected my subscription using the Select-AzureRmSubscription command. I'm not sure what could be causing this. any help would be greatly appreciated.
New-AzureRmServiceBusNamespace : Run Login-AzureRmAccount to login.
At line:1 char:2
+ New-AzureRmServiceBusNamespace -ResourceGroup AXFDEVRG -NamespaceNam ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzureRmServiceBusNamespace], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.ServiceBus.Commands.Namespace.NewAzureRmServiceBusNamespace
According to your error log, you could check as the following ways.
1.Try to create new Serviceus on Azure Portal. Please ensure your subscription has the permission to create SeviceBus.
2.Do you have multiple subscriptions? If yes, please ensure your subscription is correct.
Login-AzureRmAccount
#View all subscriptions for your account
Get-AzureRmSubscription
#Select a default subscription for your current session
Get-AzureRmSubscription –SubscriptionName "your subscription" | Select-AzureRmSubscription
3.If they don't work, please check your Azure PowerShell version.
Get-Module -ListAvailable -Name Azure -Refresh
For now, the latest version is 3.7.0. If your are old version, you could try to install the latest version from the link.

New-AzureRmResourceGroup command not working in powershell

I have logged into my Azure account and selected the appropriate subscription.
But it always gives the same error
PS C:\WINDOWS\system32> New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location "East US"
New-AzureRmResourceGroup : Run Login-AzureRmAccount to login.
At line:1 char:1
+ New-AzureRmResourceGroup -Name "AzureMediaServicesSample" -Location " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-AzureRmResourceGroup], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzur
eResourceGroupCmdlet
I have selected the subscription too using select-azuresubscription
select-azuresubscription is used for ASM mode.
For ARM mode, you need use Get-AzureRmSubscription -SubscriptionName "your sub" | Select-AzureRmSubscription to select your subscription.
More information please refer to this example.
Update:
You could use the following cmdlet to check Azure PowerShell version.
Get-Module -ListAvailable -Name Azure -Refresh
You could install the latest PowerShell from the link.
I had the same problem and I solved it by changing the environment setting from Bash to Powershell in the upper left corner of the Cloud Shell Window.

Submit U-SQL Script locally using Powershell

If I want to submit a U-SQL Script to ADLA account, I can do so, using the below powershell cmdlet.
`
Submit-AzureRmDataLakeAnalyticsJob -Account $adlaAccountName -ScriptPath $USQLFile -Name $folder -DegreeOfParallelism $degreeOfParallelism -Verbose`
But, I am not able to submit the script against local ADLA account. I am getting error:
Submit-AzureRmDataLakeAnalyticsJob : Run Login-AzureRmAccount to login.
At line:1 char:1
+ Submit-AzureRmDataLakeAnalyticsJob -Account "local" -ScriptPath GetIn ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Submit-AzureRmDataLakeAnalyticsJob], PSInvalidOperationExceptio
n
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.Azure.Commands.DataLakeAnalytics.SubmitAzureDataLakeAnalyti
csJob
How to submit U-SQL script against local ADLA account ?
In addition to ADL Tools, we have released standalone SDK as well.
https://www.nuget.org/packages/Microsoft.Azure.DataLake.USQL.SDK
And document here:
https://learn.microsoft.com/en-us/azure/data-lake-analytics/data-lake-analytics-data-lake-tools-local-run
Thanks a lot,
Yu Dong

How can I run an Azure powershell cmdlet through a proxy server with credentials?

When I run the following Powershell cmdlet (from the Azure Management Tools Snapin):
get-osversions -subscriptionId **** -certificate (get-item cert:\CurrentUser\MY\******)
I get the following error message:
Get-OSVersions : The remote server returned an unexpected response: (407) Proxy Authenti
cation Required.
At line:1 char:15
+ get-osversions <<<< -subscriptionId * -certificate
(get-item cert:\CurrentUser\MY*****)
+ CategoryInfo : CloseError: (:) [Get-OSVersions], ProtocolException
+ FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedS
ervices.GetOSVersionsCommand
Get-OSVersions : Object reference not set to an instance of an object.
At line:1 char:15
+ get-osversions <<<< -subscriptionId * -certificate
(get-item cert:\CurrentUser\MY***)
+ CategoryInfo : CloseError: (:) [Get-OSVersions], NullReferenceException
+ FullyQualifiedErrorId : Microsoft.Samples.AzureManagementTools.PowerShell.HostedS
ervices.GetOSVersionsCommand
It seems that the internet proxy server here is denying the script the access it requires.
I've had a good look around on the internet and it seems that there is no easy way around this problem since this cmdlet does not have a valid "-credentials" or proxy server parameter.
I know there is a 'Get-Credential' cmdlet but I don't think it helps. How would you pass the credential to the Azure cmdlet?
Can anyone think of any way to get around this issue?..
...other than using a different non-proxied internet connection?
I'm stumped.
Many Thanks for your time.
Easier:
[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
A few customers I know were successful using the method outlined here (Supporting Basic Auth proxies). If you need other proxy types, it follows the same pattern. The nice thing about this is it does not require changing the cmdlets.