azure-sdk-for-net
azure-sdk-for-net copied to clipboard
[QUERY] How to get Id of ArmDeploymentResource when creating deployment with WaitUntil.Started
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
Thank you for your feedback. Tagging and routing to the team member best able to assist.
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.
Thanks for the reply and workaround @ArcturusZhang, feel free to close the issue.