Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 22, 2025

Description

Adds environment-specific connection ID support for semantic_model_binding parameter to eliminate manual reconfiguration after deployment across environments.

Changes

Parameter Validation (_parameter.py)

  • Accept connection_id as string (backward compatible) or dictionary (per-environment)
  • Add _validate_connection_id_dict() method with GUID format validation
  • Support _ALL_ environment key for universal connection binding
  • Validate environment presence in dictionary, skip binding when target environment missing

Semantic Model Publishing (_semanticmodel.py)

  • Resolve environment-specific connection_id from dictionary at publish time
  • Handle _ALL_ key resolution with case-insensitive matching
  • Log skip events when target environment not found in binding configuration

Documentation & Tests

  • Document both string and dictionary formats with examples
  • Add 7 unit tests covering validation, GUID format, backward compatibility
  • Update sample parameter.yml with both format examples

Usage

semantic_model_binding:
    # Per-environment connection IDs
    - connection_id:
        PPE: "76e05dfe-9855-4e3d-a410-1dda048dbe99"
        PROD: "a1b2c3d4-5678-90ab-cdef-1234567890ab"
      semantic_model_name: ["model1", "model2"]
    
    # Single connection ID (backward compatible)
    - connection_id: "12345678-1234-1234-1234-123456789abc"
      semantic_model_name: "model3"

Linked Issue (REQUIRED)

Issue linking handled via PR title.

Original prompt

This section details on the original issue you should resolve

<issue_title>Feature Request: Support semantic model binding per environment</issue_title>
<issue_description>### What is the feature?

Right now if I understand everything correctly there is no other way just full release. I have a problem with semantic models because with every release a connected data source is delete and I need to assign it again. With dozens of semantic models released through your library it is time demanding and even may caused failure of schedules refreshes when I forget to assign the data source after the release.
With connected branch to Fabric workspace and updating from Git there is no such issue because this approach is not deleting the item just updating it.
Would it be possible to implement something similar to your library?

Additional context

No response</issue_description>

Comments on the Issue (you are @copilot in this section)

@shirasassoon @ZdenekSoldan Thanks for your question. The library _does_ support selective deployments (though not recommended) either through specifying a regex string which is used to exclude item from getting published or by providing a specific list of items to get published. Please find documentation [here](https://microsoft.github.io/fabric-cicd/latest/code_reference/#fabric_cicd.publish_all_items). Hope this answers your question. @shirasassoon @ZdenekSoldan Thanks for the clarification, the library does full deployment each time. With regards to the connections in the Semantic Models, are you using parameterization to configure it or fully doing this manually? @shirasassoon @ZdenekSoldan Is this something you can use in your scenario? https://microsoft.github.io/fabric-cicd/latest/how_to/parameterization/#semantic_model_binding @shirasassoon @ZdenekSoldan Currently this is not supported, however, it's a feature we can look into adding. Would the following format support your use case?
semantic_model_binding:
    - connection_id: 
        PPE: "76e05dfe-9855-4e3d-a410-1dda048dbe99"
        PROD: "a1b2c3d4-5678-90ab-cdef-1234567890ab"
      semantic_model_name: ["cloudconnections", "MySemanticModel_ADLS_Gen2"]
</body></comment_new>
</comments>

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits December 22, 2025 12:51
- Add support for environment-specific connection IDs in semantic_model_binding parameter
- Update parameter validation to accept both string and dictionary for connection_id
- Add _validate_connection_id_dict method to validate GUID format in dictionary values
- Update publish_semanticmodels to resolve environment-specific connection IDs
- Support _ALL_ environment key for universal connection ID
- Add comprehensive tests for new functionality
- Update documentation with examples and notes
- Update sample parameter.yml file with examples

Co-authored-by: shirasassoon <[email protected]>
- Remove unnecessary local import of re module (already imported at top)
- Replace list membership checks with direct equality for single value comparisons
- Improve code readability and performance

Co-authored-by: shirasassoon <[email protected]>
Copilot AI changed the title [WIP] Add support for semantic model binding per environment Closes #520 - Support semantic model binding per environment Dec 22, 2025
Copilot AI requested a review from shirasassoon December 22, 2025 12:58
@shirasassoon shirasassoon changed the title Closes #520 - Support semantic model binding per environment Closes #689 - Support semantic model binding per environment Dec 22, 2025
@shirasassoon shirasassoon marked this pull request as ready for review December 22, 2025 13:37
@shirasassoon shirasassoon requested a review from a team as a code owner December 22, 2025 13:37
Copilot AI review requested due to automatic review settings December 22, 2025 13:37
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds environment-specific connection ID support for semantic model bindings, allowing users to specify different connection IDs per environment (PPE, PROD, etc.) or use a single connection across all environments. This eliminates the need for manual reconfiguration of data source connections after deployment across different environments.

Key Changes:

  • Enhanced connection_id parameter to accept both string (backward compatible) and dictionary formats (environment-specific)
  • Added GUID validation for connection IDs in dictionary format
  • Implemented environment-specific connection ID resolution at publish time with support for _ALL_ environment key

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/fabric_cicd/_parameter/_parameter.py Added validation logic for dictionary-based connection_id, GUID format validation, and environment-specific handling
src/fabric_cicd/_items/_semanticmodel.py Implemented connection_id resolution logic to select appropriate connection based on target environment
tests/test_parameter.py Added 7 unit tests covering string/dictionary formats, GUID validation, and edge cases
docs/how_to/parameterization.md Documented both connection_id formats with examples and usage notes
sample/workspace/parameter.yml Updated sample configuration with examples of both string and dictionary connection_id formats

@shirasassoon shirasassoon marked this pull request as draft January 19, 2026 12:48
@shirasassoon shirasassoon marked this pull request as ready for review February 1, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Support semantic model binding per environment

2 participants