I am trying to extract a powershell task into a task group in order to reuse the script and I wanted to pass some parameters as variables but it seems the pipeline doesn't identify those as task group variables:

Nothing happens in this case. The _command line_ task has the same problem. I tried to add another non-cmd task and there it worked as expected. This issue might be related to #8737 but is still slightly different
Found a strange workaround. If you use $(some text) in your powershell script then the some text is exposed as a variable. Like this
Select-String -Pattern "$(Include Filter)" -Quiet
And the Include Filter variable pops up and I can use it from a parent task.
Looks like an issue with task groups ... routing
We only consider any $(Var) format and parameterize it as part of task group.
Hit this today, have an environment variable in a task within a task group with a value in format $(Var) and it does not appear as a parameter. If I enter the variable in another part of the task, such as script arguments it does appear. So seems specific to environment variables.
Ran into the same thing today (Azure Pipelines latest (Sprint 165)).
If you define a variable in Control Options > Custom Condition, it's not picked up by the Create Task Group dialog.
I tried both syntaxes: eq('$(PublishArtifacts)', 'true') and eq(variables['PublishArtifacts'], 'true') - neither worked.
Edit: The workaround by @stukalin works great, but having an extra step in the process is less than desirable.
This issue is stale because it has been open for 180 days with no activity. Remove the stale label or comment on the issue otherwise this will be closed in 5 days
Still an issue - bad bot!
Most helpful comment
Found a strange workaround. If you use
$(some text)in your powershell script then thesome textis exposed as a variable. Like thisSelect-String -Pattern "$(Include Filter)" -QuietAnd the
Include Filtervariable pops up and I can use it from a parent task.