azure-sdk-for-net icon indicating copy to clipboard operation
azure-sdk-for-net copied to clipboard

[QUERY] How to get Id of ArmDeploymentResource when creating deployment with WaitUntil.Started

Open linda-chin opened this issue 2 years ago • 2 comments
trafficstars

Library name and version

Azure.ResourceManager.Resources 1.3.1.0

Query/Question

Hi, sorry if this has already been asked, but when I create an ArmDeployment with WaitUntil.Started, how can I get the Id of the deployment? Currently the ArmOperation<ArmDeploymentResource> object that is returned from CreateOrUpdateAsync has an Id but it throws NotImplementedException.

Previously with Microsoft.Azure.Management.ResourceManager.Fluent, when I create the deployment with BeginCreate, I can get the Id from result.Inner.Id. We do this so we can keep track of the state of the deployment.

Environment

No response

linda-chin avatar Feb 12 '23 23:02 linda-chin

Thank you for your feedback. Tagging and routing to the team member best able to assist.

jsquire avatar Feb 13 '23 13:02 jsquire

Hi @linda-chin thank you for this issue Unfortunately there is no way to get the Id until the long running operation is complete. This is because the Id in a resource is taking from the Id property in the response and until the operation is done, the SDK cannot have the Id.

As a workaround, you could construct one use the static method ArmDeploymentResource.CreateResourceIdentifier with your argument when calling the CreateOrUpdateAsync method.

ArcturusZhang avatar Feb 16 '23 06:02 ArcturusZhang

Thanks for the reply and workaround @ArcturusZhang, feel free to close the issue.

linda-chin avatar Feb 22 '23 00:02 linda-chin