stevebus / unrealdemo

Temporary placeholder (for the Beta) for the Unreal Engine ADT plug-in for Azure Digital Twins
MIT License
3 stars 1 forks source link

Deploy Resources: Cannot add or remove default routes..... #3

Open dfknowlesLittle opened 3 years ago

dfknowlesLittle commented 3 years ago

As part of the deployment of the Azure resource using this command az deployment group create -g $rgname -f ./azuredeploy.bicep --parameters projectName=$projectname userId=$myuserid appRegId=$appregobjectid

I got the following error in the Azure Portal for the deployment to the resource group:

{ "code": "DeploymentFailed", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.", "details": [ { "code": "400126", "message": "Cannot add or remove default routes, default route names are :RouteToEventGrid. If you contact a support representative please include this correlation identifier: db018c1c-b198-4c5a-9379-a2bf3bff6fb4, timestamp: 2021-06-21 21:41:30Z, errorcode: IH400126." } ] }

stevebus commented 3 years ago

Hi @dfknowlesLittle - the only time we've seen this issue (which is known) is if you tried to do the deployment twice (it fails the second time with this error). Was this on a second deployment?

Either way, the fix is to

rerun your deployment... Note that if you've closed the cloud shell since you ran through it the first time, you will have lost the bash variables that we need for the deployment command.. If you, you need to re-run these commands before you try the deployment again....

projectname= rgname=${projectname}-rg myuserid=$(az ad signed-in-user show --query objectId -o tsv) && echo $myuserid appregname='http://'${projectname}-appreg appregobjectid=$(az ad sp show --id $appregname --query objectId -o tsv) && echo $appregobjectid

I think that gets all the variables set that you need for the deployment...

dfknowlesLittle commented 3 years ago

Thanks, @stevebus. Yes, I did a redeploy from inside the Azure portal after I fixed the first issue I encountered and resolved.

The above instructions worked well. I had closed the cloud shell so I also needed to run: cd ~/unrealdemo/deployment

The deployment ran for 6.5 minutes and failed. This time the error is:

{ "code": "DeploymentFailed", "message": "At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details.", "details": [ { "code": "DeploymentScriptError", "message": "The provided script failed with the following error:\r\nUnknownError: code: EventRouteEndpointInvalid - , The endpoint provided does not exist or is not active. Check that your endpoint is provisioned correctly. See event route documentation (http://aka.ms/ADTv2Routes).. Please refer to https://aka.ms/DeploymentScriptsTroubleshoot for more deployment script information." } ] }

stevebus commented 3 years ago

Ok - First, I just re-ran a fresh deployment to make sure we didn't break anything.. no issues

I think your issue may be a consequence of re-running a failed deployment. Can you do me a favor and check a couple of things (and then I'll suggest a way around this....)

In the Azure portal, under your resource group, should be a list of azure resources it created... Can you see if there is one that is of type "Event Grid Topic" that includes the word 'changelogtopic' in the name, like this?

image

Assuming there is, next, find the item of type "Azure Digital Twins" and click on it.. On the left nav, click on "Endpoints" and tell me what you see there... And finally, in the left name, click on "Routes" and tell me what you see there...

Now, finally, to try to get you past this, let's start fresh... We'll just nuke all the azure resources from the failed deployment and start over... In the Azure Portal, under "Resource Groups", click into your resource group that just got created from the deployment. You should see a "Delete Resource Group" button at the top. Click that, then re-type the name of the resource group in the box to confirm, and then click "Delete".

Once that is done (click on the little "Bell" on the top nav bar to see progress), then you can retry your deployment. If you still have your cloud shell open (and the variables set), you can just rerun the deployment line (the one that starts with 'az deployment group......')

If you had close your cloud shell, you'll need to re-run the commands from my first comment above

Let me know if this helps.

dfknowlesLittle commented 3 years ago

The Endpoints of the Azure Digital Twin resource are: @.***D7675B.4D046EE0]

There are no Event Routes for the Azure Digital Twin resource.

I'll delete the resource group and give it a go again. Thanks for the help.

Regards, -Dan

stevebus commented 3 years ago

Is this...

image

The actual name you saw under "endpoints"?

Definitely have not run across that before. But I still think it's a symptom of something hosed up in re-running the failed deployment.

it should look something like this when successful (with the first part of the name matching your project name)

image

Let me know how deleting and starting over works...

dfknowlesLittle commented 3 years ago

Replying via email did not render the screenshot correctly. Here is a screenshot of the Endpoint:

Azure DT Endpoint

dfknowlesLittle commented 3 years ago

It failed again with the same error. I have the Azure Digital Twin resource with the one Endpoint, but no Event Routes.

stevebus commented 3 years ago

Ok, strangely that's the very last step of the deployment and one that I've never seen fail... Just sent you an email about seeing if we can get on a call and troubleshoot.

Definitely interested in hearing if anyone else hits this issue...

stevebus commented 3 years ago

Set up a call w/ Dan... We re-ran the deployment and it worked fine :-). No explanation, but I suspect a potential race condition

Closing this, but leaving it all here in case anyone else hits it!

AndersRod commented 3 years ago

I was running into a similar error on my initial deployment. The PostDeploymentscript resource failed with the code EventRouteEndpointInvalid and there was no event route in the Azure Digital Twin resource (only an endpoint). After following the above steps (manually removing IoTHubIngest), I could redeploy the resources successfully.

stevebus commented 3 years ago

Thanks @AndersRod -- It seems that we have some kind of race condition where we attempt to create the route before Azure "settles down" and finishes creation of the endpoint (which happens immediately before). I'll re-open and see if I can come up with a fix.. maybe a 'sleep' for a few seconds. Thanks for following up and re-reporting it.