Forum Discussion

jameshao's avatar
jameshao
Copper Contributor
Dec 17, 2023

Rename Application Insights programmatically

Does anybody know how to rename Application Insights via PowerShell, azure cli, Rest API or any other methods? Is this possible? 

 

I have large number of Application Insights to migrate from classic to log analytic workspace based and also need to recreate them in a different region, so want to rename them as backup first before recreating them. Rename can be done on portal, but I need to find a programmatical way to rename them so that it can integrated into my migration script. 

 

My test with PowerShell, azure cli, Rest API patch so far are not successful to rename an appInsights. What action is actually performed at the back when renaming on the portal, like cloning then deleting? 

  • Florian185's avatar
    Florian185
    Copper Contributor

    I have tested this
    There is no api traffic in the Inspector, so the change must happen on the server side.
    But if we look in the change analysis, we see that after we renamed, the resource with the old name was deleted.
    It can therefore be assumed that it is actually deleted and recreated.
    The fact that the name in powershell is a read only attribute also indicates this.

Resources