Line 53 has the erroraction on the end of line, but should be moved left of the pipe for the new-azroleassignment, could even remove the write-verbose and pipe altogether.
Otherwise the script error stops and fails to return application id.
In my case the system appears to automatically assign the role and that caused the first new-azroleassignment to return null due to the role already being assigned.
Line 53 has the erroraction on the end of line, but should be moved left of the pipe for the new-azroleassignment, could even remove the write-verbose and pipe altogether. Otherwise the script error stops and fails to return application id.
In my case the system appears to automatically assign the role and that caused the first new-azroleassignment to return null due to the role already being assigned.