The macro-id attribute is used to identify macros within a page. If one is not provided, or if two macros have the same id, Confluence will create one on its own.
The macro-id attribute was introduced in Confluence 5.8: https://developer.atlassian.com/server/confluence/preparing-for-confluence-5-8/#storage-format-changes-for-macros
So, if you're creating a custom user macro, it may be safe to omit this attribute. Let Confluence do its thing and provide one once the macro is added to a page.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.