Creating Azure Bus Service using Azure Powershell throwing exception - azure

I'm trying to create Azure Service Bus using Azure powershell command.
I'm using command as :
New-AzureSBNamespace –Name UKBProjectServiceBus -Location "West US" -CreateACSNamespace $true -NamespaceType Messaging
But getting exception as:
New-AzureSBNamespace : InternalError: The server encountered an internal error. Please retry the request.
At line:1 char:1
+ New-AzureSBNamespace -Name UKBProjectServiceBus -Location "West US" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureSBNamespace], CloudException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceBus.NewAzureSBNamespaceCommand
Can anyone please help me?

This PowerShell command for Service Bus will no longer be supported on 11/1/2019. The Azure Service Management model is deprecated for Service Bus, and will be disabled on that date. Please use the commands which support the Azure Resource Management model in AzureRM.ServiceBus.
As Gaurav and Rohit said, the New-AzureSBNamespace is a really old Powershell Cmdlet to use.
You could use New-AzureRmServiceBusNamespace -ResourceGroup $ResGrpName -NamespaceName $Namespace -Location $Location to create Azure ServiceBus. Refer to this one.
Or use New-AzServiceBusNamespace -ResourceGroupName Default-ServiceBus-WestUS -Name SB-Example1 -Location WestUS to create Azure ServiceBus. Refer to this one.

Related

Getting error in azure powershell while creating new storage account using the command New-AzStorageAccount

$storageAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup -Name "blobstgaccdemo" -SkuName Standard_LRS -Location $location
New-AzStorageAccount : An error occurred while sending the request.
At line:1 char:19
+ ... geAccount = New-AzStorageAccount -ResourceGroupName $resourceGroup -N ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzStorageAccount], HttpRequestException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Management.Storage.NewAzureStorageAccountCommand
This is a generic error and can occur in more than a few conditions, including when Azure PowerShell is not able to reach/resolve the underlying management REST APIs, or in case of SSL errors.
To get more information about the error, run the PS cmdlet passing the -Debug parameter along, or set $DebugPreference to Continue before executing the cmdlet. This would surface the details of the exception along with the stack trace.
If this is consistently happening with other cmdlets as well, then you could try upgrading PS modules, or re-installing Azure PowerShell itself. Another quick alternative would be to use Azure Cloud Shell that is preconfigured with all the required modules.

New-AzureRmResource : InternalServerError : Encountered an internal server error. while creating cloud service through Azure Powershell 5.0.0

Getting below error while creating cloud Service through Azure Powershell 5.0.0
And I am able to create cloud service though portal for the same input.
Does anybody have any idea. the same code was working perfectly fine last couple of months. but since couple of days i am seeing this error.
[DBG]: PS D:\MSTeams\Source\Repos\SkypeSpaces-Infra\tools\Azure>> New-AzureRmResource -Name $ServiceName -ResourceType "Microsoft.ClassicCompute/domainNames" -Location $Location.Location -ResourceGroupName $ResourceGroupName -Force:$Force -ErrorAction SilentlyContinue
New-AzureRmResource : InternalServerError : Encountered an internal server error. The tracking id is '862cb19d-4485-4ef8-a847-657beaeb7c90'.
At line:1 char:1
+ New-AzureRmResource -Name $ServiceName -ResourceType "Microsoft.Class ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmResource], ErrorResponseMessageException
+ FullyQualifiedErrorId : InternalServerError,Microsoft.Azure.Commands.ResourceManager.Cmdlets.Implementation.NewAzureResourceCmdlet
Thanks in advance.

Trying to create resource group using New-AzureRmResourceGroup cmdlet in azure webjob

I have a working azure arm powershell scripts to create a new virtual machine and it's working fine in cloud service but when I am trying to execute in azure webjob, I am getting following Error :
New-AzureRmResourceGroup -Name $resourceGroup -Location $location
New-AzureRmResourceGroup : The Win32 internal error "The handle is invalid"
0x6 occurred while setting character attributes for the console output buffer.
Contact Microsoft Customer Support Services.
At D:\local\Temp\jobs\triggered\webjob\v43suxvk.lln\testDrives\WindowsServer201
2\provision.ps1:17 char:1
+ New-AzureRmResourceGroup -Name $resourceGroup -Location $location
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureRmResourceGroup], Host
Exception
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.Resources.NewAzureResou
rceGroupCommand
so how can I run arm powershell scripts in webjobs?

Azure Automation: VM shutdown runbook not working on new VM

I recently had to delete and re-install my VM due to an issue with the VM locking up. Now that the VM is back online, I noticed the shutdown automation is not working. It was working fine before I ran into the issue with the VM. Below is the PS script from the runbook, it returns the following error:
Correlation ID: 72fa8e58-89f1-4612-bc43-1b05876c2bff
Timestamp: 2015-08-25 06:04:14Z: The remote server returned an error: (401) Unauthorized.
At Shutdown:6 char:6
+
+ CategoryInfo : CloseError: (:) [Add-AzureAccount], AadAuthenticationFailedException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.Profile.AddAzureAccount
8/24/2015 11:04:25 PM, Error: Get-azurevm : No default subscription has been designated.
Use Select-AzureSubscription -Default <subscriptionName> to set the default subscription.
At Shutdown:8 char:8
+
+ CategoryInfo : CloseError: (:) [Get-AzureVM], ApplicationException
+ FullyQualifiedErrorId : Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.GetAzureVMCommand
Any idea what I am missing to get this working with new VM? I have been wracking my brain for something with the credentials that would not include this new VM, but have come up empty handed.
workflow Shutdown
{
$Cred = Get-AutomationPSCredential -Name "auto"
Add-AzureAccount -Credential $Cred
$vms = Get-azurevm
foreach($VM in $VMS)
{
$VMName = $VM.Name
Stop-AzureVM -ServiceName $VM.ServiceName -Name $VM.Name -Force
Write-Output "Shutting down VM : $VMName "
}
}
I think you should also add the subscription name (select-azuresubscription in the error log) in the script you are using. There are quite some examples of doing this in various ways in the TechNet Script libraries like this one https://gallery.technet.microsoft.com/scriptcenter/Stop-Azure-VM-with-OrgID-41a79d91
I created a new user, granted them admin rights to the subscription, and updated the credential. That seemed to fix it, guessing it was something with the existing co-admin account not having access to the new VM.

Error creating web app slot with Azure Powershell cmdlet

I can successfully create a new Azure Web App with this command (provided the resource group and app service plan exist, of course):
New-AzureWebApp `
-Name site-name `
-ResourceGroupName resource-group-name `
-Location 'North Central US' `
-AppServicePlan app-service-plan-name
But when I try to add a slot with a similar command it fails:
New-AzureWebApp `
-Name site-name `
-ResourceGroupName resource-group-name `
-Location 'North Central US' `
-AppServicePlan app-service-plan-name `
-SlotName dev # <--------------------------- this line is added
with the error:
New-AzureWebApp : MismatchingResourceName: The provided resource name 'site-name'
did not match the name in the Url 'site-name/dev'.
At line:1 char:1
+ New-AzureWebApp -SlotName "dev" -Name "site-name" -Location "North ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [New-AzureWebApp], CloudException
+ FullyQualifiedErrorId : Microsoft.Azure.Commands.WebApp.Cmdlets.NewAzureWebAppCmdlet
What's going on here? Am I not going about making slots the right way?
Note: I'm using Azure Powershell in AzureResourceManager mode.
This AzureServiceManagement mode command does work so I'm not entirely lost:
New-AzureWebsite -Name "site-name" -Slot "dev" -Location "North Central US"
But why can't I get the former command to work?
What is your App Service plan mode? I hope this is already been taken care, and you should be in either Standard or Premium plan.
This seems to be a issue with the latest release of Azure modules. Will have to wait till the issue is fixed. Probably you might need to raise a Azure Support ticket to bump up the priority.

Resources