Search code examples
azure-resource-managerazure-powershell

How to Detach shared image gallery from DevTest lab in azure


We have a requirement to detach the shared image gallery from DevTest Lab in Azure. We tried the below code API snippet to attach.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}?api-version= 2018-10-15-preview
Body: 
{
    "properties":{
        "galleryId": "[Shared Image Gallery resource Id]",
        "allowAllImages": "Enabled"
    }
}

We can enable shared image gallery to DevTest lab . Can we detach shared image gallery with API or ARM template


Solution

  • Yes, you can, just use the REST API like below.

    DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DevTestLab/labs/{labName}/sharedgalleries/{name}?api-version= 2018-10-15-preview
    

    enter image description here