Move-AzureRmResource fails randomly - powershell

I am trying to move Service Bus Namespace to a different resource group using powershell commands. The code below sometimes works and sometimes fails.
$Resource = Find-AzureRmResource -ResourceType "Microsoft.ServiceBus/Namespaces" -ResourceNameContains $ServiceBusNamespace
Move-AzureRmResource -DestinationResourceGroupName $ResourceGroupName -ResourceId $Resource.ResourceId -Force
And here is a random error information:
Move-AzureRmResource : ResourceMoveFailed : Resources
'/subscriptions/f24b849a-ba33-4bd9-a87e-eca0df1cbcd2/resourceGroups/Default-ServiceBus-WestEurope/providers/Microsoft.ServiceBus/namespaces/cokolwiekNamespace'
could not be moved. The tracking Id is '64c
52d24-a471-490d-b18a-b7838966a8e0'
What does the tracking Id means? Can I find it in some logs and have more meanigfull information?

Thank you for your question.
I reproduce the same error in my lab, when I try to move my service bus to destination resource group, the destination resource group’s location is different from the source resource group. In fact, there are many reasons for this error. There are some important steps to perform before moving a resource. By verifying these conditions, you can avoid errors.
More information about move resource to new resource group, please refer to the link below:
https://azure.microsoft.com/en-us/documentation/articles/resource-group-move-resources/
The tracking id is a randomly generated, different operations have different tracking id.
If you want to see the logs about the PowerShell, we can find the logs in localhost, run “eventvwr”, and select the “Applications and Services logs” -> “Microsoft”-> “windows” “PowerShell”-> “Operational”. like:
The picture of powershell logs in localhost
If you still have questions, welcome to post back here. Thanks.

Related

Kubeflow fails to deploy using both CLI and Console

I deleted my KF cluster last night to create a new one (using kubectl cluster command not Kfctl delete), and then when I tied to create a new one, it fails, it does not work with CLI not Console. I found other people have run into this issue before, for example (here and here)
"However, as I said even with CLI my deployment fails, the error from console is:
ailed to apply: (kubeflow.error): Code 500 with message: coordinator Apply failed for gcp: (kubeflow.error): Code 500 with message: gcp apply could not update deployment manager Error could not update storage-kubeflow.yaml; Insert deployment error: googleapi: Error 403: Request had insufficient authentication scopes.
More details:
Reason: insufficientPermissions, Message: Insufficient Permission"
and the error I get from Console is:
"Please enable APIs for your project and try again
Please enable cloud resource manager API: https://console.developers.google.com/apis/api/cloudresourcemanager.googleapis.com/ and iam API: https://console.developers.google.com/apis/api/iam.googleapis.com/"
Note that this error is wrong, all the apis are active already. I'm quite sure this is a bug of KF but not sure how to find a workaround, any thoughts?
With CLI, I'm using my own account which has "owner" privileges.
Thanks
It seems you have an issue with IAM and the installation of Kubeflow, a 3rd party product that itself is not supported by us; nevertheless I went ahead and dig some information about this Machine Learning product.
The main issues (and although it seems you already cover permissions) are permissions, number of projects and some fine grained points.
I was checking and found out the following things that may help
a) Troubleshooting Kubeflow 1
b) Deploying Kubeflow in GKE[2]
c) Kubleflow auto deployer for GKE[3]
There are also some discussion about a mismatch permissions setting in Kubeflow that may be worth reading [4]
Finally there is a group that, also on a best-effort basis due the nature of Kubeflow:"google-kubeflow-support#google.com" that may come in handy.
I trust this information will be useful for you to solve your issue

Issue with service fabric resource manager file deployment (apim.json and apim.parameters)

My requirement is as follows:
I have an web API whose port I have removed from the ServiceManifest.xml file. This is done so that I can implement multiple node multiple calls feature from API management. (i.e. I want to remove dependency on port number)
While deploying API management resource files, I am facing issues while deploying apim.json and apim.parameters.json file.
Following is the exception I am getting always.
"Service activation failed. Please look at the details in Activity Log on the left side. In case you are deploying into VNET please make sure prerequisites are followed as described on https://aka.ms/apiminvnet"
There is nothing in the log files when I am uploading.
I am using following link for the deployment and testing. https://learn.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-deploy-api-management
I am getting exception in running powershell script
New-AzureRmResourceGroupDeployment -ResourceGroupName $groupname -TemplateFile "$templatepath\apim.json" -TemplateParameterFile "$templatepath\apim.parameters.json" -Verbose

Associate a Public IP in an Azure Resource Group to a Web App?

I'm playing around with Azure Resource Groups.
I've created a group, and in it, I've created a web app. (This is all just academic and I'll delete it all when I'm done leaning, so I don't mind sharing the data.) The web app is located at http://woodswild.azurewebsites.net, and indeed you can go to that address and it will resolve (although there is nothing there, which is fine for now.)
Then, in the same resource group, I also created a Public IP Address that is static.
That all looks good (I think, anyway). But in the Portal UI, I see that this IP is not associated to anything:
Aaannndd.... I'm having a hard time figuring out how to do that. I created the Public IP from within Azure PowerShell with this command:
New-AzureRmPublicIpAddress -AllocationMethod Static -ResourceGroupName TestRG1 -ReverseFqdn woodswild.centralus.cloudapp.azure.com -Name woodswild.azurewebsites.net -Location "Central US" -DomainNameLabel woodswild
According to this article that explains the New-AzureRmPublicIpAddress command, there is no parameter to declare an association. I'm not seeing a way to do it in the Portal UI, and I can't find any answers via Google.
What I'm hoping / wondering / assuming is that once this association is made, you could put the IP Address in a browser and it would resolve to the same place as http://woodswild.azurewebsites.net.
Any ideas? Thanks!!
It is not actually possible to assign a static IP address to a Web App. This is because the IP address used by Web Apps isn't used exclusively by you, but instead it is the frontend address pool of the load balancers that sit in front of Azure's Web App service.
However Microsoft do assert that any web app that can have a domain name assigned will keep its external incoming address, and external outgoing addresses for the lifetime of the Web App. This applies to Basic, Standard and Premium SKU. (it might apply to Shared too - I'll have to dig out the doc)
You can find your external incoming IP Address with (yeah, basically, ping it and see what DNS gives!)
Resolve-DnsName (Get-AzureRmWebApp `
-ResourceGroupName $ResourceGroupName -Name $Name).EnabledHostNames[0]
and your external outgoing IP Addresses with
(Get-AzureRmWebApp -ResourceGroupName $ResourceGroupName `
-Name $Name).OutboundIpAddresses
It seems I fell at the first hurdle here, and didn't actually read the question. Or at least my brain seems to have read different words than the ones that are there! (I'll leave the wrong answer here because a, it might be useful to someone, b, I'll likely paste it into an actual answer that it fits one day)
The reason this is so confusing is that it is not instantly obvious the process that Azure uses to update resources.
For the majority of existing resource changes that are made in Azure, the process goes something like
Get-something, assign it to a variable.
Change a property of that variable, by assigning some other value.
Write the change to Azure using the Set-something cmdlet.
In the case of assigning an IP address to a VM, this is the code to use
$ipaddr = New-AzureRmPublicIpAddress -Name test1 `
-ResourceGroupName win10 `
-Location westeurope `
-AllocationMethod Static
$nic = Get-AzureRmNetworkInterface -Name $name `
-ResourceGroupName $ResourceGroupName #1
$nic.IpConfigurations[0].PublicIpAddress = $ipaddr #2
Set-AzureRmNetworkInterface -NetworkInterface $nic #3

Get-AzureRmResourceGroupDeployment lists machines I cannot see in the web interface

I'm tasked with automating the creation of Azure VM's, and naturally I do a number of more or less broken iterations of trying to deploy a VM image. As part of this, I automatically allocate serial hostnames, but there's a strange reason it's not working:
The code in the link above works very well, but the contents of my ResourceGroup is not as expected. Every time I deploy (successfully or not), a new entry is created in whatever list is returned by Get-AzureRmResourceGroupDeployment; however, in the Azure web interface I can only see a few of these entries. If, for instance, I omit a parameter for the JSON file, Azure cannot even begin to deploy something -- but the hostname is somehow reserved anyway.
Where is this list? How can I clean up after broken deployments?
Currently, Get-AzureRmResourceGroupDeployment returns:
azure-w10-tfs13
azure-w10-tfs12
azure-w10-tfs11
azure-w10-tfs10
azure-w10-tfs09
azure-w10-tfs08
azure-w10-tfs07
azure-w10-tfs06
azure-w10-tfs05
azure-w10-tfs02
azure-w7-tfs01
azure-w10-tfs19
azure-w10-tfs1
although the web interface only lists:
azure-w10-tfs12
azure-w10-tfs13
azure-w10-tfs09
azure-w10-tfs05
azure-w10-tfs02
Solved using the code $siblings = (Get-AzureRmResource).Name | Where-Object{$_ -match "^$hostname\d+$"}
(PS. If you have tips for better tags, please feel free to edit this question!)
If you create a VM in Azure Resource Management mode, it will have a deployment attached to it. In fact if you create any resource at all, it will have a resource deployment attached.
If you delete the resource you will still have the deployment record there, because you still deployed it at some stage. Consider deployments as part of the audit trail of what has happened within the account.
You can delete deployment records with Remove-AzureRmResourceGroupDeployment but there is very little point, since deployments have no bearing upon the operation of Azure. There is no cost associated they are just historical records.
Querying deployments with Get-AzureRmResourceGroupDeployment will yield you the following fields.
DeploymentName
Mode
Outputs
OutputsString
Parameters
ParametersString
ProvisioningState
ResourceGroupName
TemplateLink
TemplateLinkString
Timestamp
So you can know whether the deployment was successful via ProvisioningState know the templates you used with TemplateLink and TemplateLinkString and check the outputs of the deployment etc. This can be useful to figure out what template worked and what didn't.
If you want to see actual resources, that you are potentially being charged for, you can use Get-AzureRmResource
If you just want to retrieve a list of the names of VMs that exist within an Azure subscription, you can use
(Get-AzureRmVM).Name

Cannot start Windows Azure VM programmatically

I'm performing REST API operation Start Role (http://msdn.microsoft.com/en-us/library/jj157189.aspx)
In the link https://management.core.windows.net/{subscription-id}/services/hostedservices/{service-name}/deployments/{deployment-name}/roles/{role-name}/Operations we have replaced {service-name}, {deployment-name} and {role-name} with name of VM.
In result we have next message:
"ResourceNotFoundThe resource service name hostedservices is not supported."
List Hosted Services operation (http://msdn.microsoft.com/en-us/library/windowsazure/ee460781.aspx) shows us that we have 2 WMs as hosted services.
Get Role operaion (http://msdn.microsoft.com/en-us/library/jj157193.aspx) also gives info about each of VMs.
Thanks in advance.
You are using:
{subscription-id}/services/hostedservices/{service-name}/deployments/{deployment-name}/roles/{role-name}/Operations
But the correct Uri is:
{subscriptionID}/services/hostedservices/{serviceName}/deployments/{deploymentName}/roleInstances/{roleInstanceName}/Operations
See the difference?
I haven't worked with this particular operation, however a few things:
service-name: It should be the name of the hosted service (the one with .cloudapp.net) and what you see when you list your hosted service.
deployment-name: Generally speaking it's a GUID returned by Get Deployment operation (http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx).
role-name: Role name is also returned when you do a Get Deployment operation. You should use that. I'm not sure if it is same as the name of your VM.
Can you retry your operation after changing these values?
In my case, deployment name is the name of the first VM I created in this cloud service. So, if I added 3 machines to the same cloud service, all of them have the same deployment name - the name of the first machine.