Skip to content

Commit

Permalink
Update Microsoft Graph Bicep types (#13948)
Browse files Browse the repository at this point in the history
Updating Microsoft Graph Bicep types and remove `microsoftGraphPreview`
experimental feature flag.
###### Microsoft Reviewers: [Open in
CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/Azure/bicep/pull/13948)
  • Loading branch information
jason-dou authored Apr 26, 2024
1 parent 52025f9 commit 89e2582
Show file tree
Hide file tree
Showing 39 changed files with 150 additions and 133 deletions.
6 changes: 3 additions & 3 deletions src/Bicep.Cli.IntegrationTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1370,7 +1370,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Cli.UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1189,7 +1189,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Cli/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1087,7 +1087,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public class CentralizedProviderVersionManagementTests : TestBase
private ServiceBuilder Services => new ServiceBuilder()
.WithFeatureOverrides(new(
ExtensibilityEnabled: true,
DynamicTypeLoadingEnabled: true,
MicrosoftGraphPreviewEnabled: true));
DynamicTypeLoadingEnabled: true));

[TestMethod]
[DynamicData(nameof(ProvidersConfig_SupportForConfigManagedProviderDeclarationSyntax_When_ProviderIsBuiltIn_TestCases))]
Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.Core.IntegrationTests/ExamplesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public Task ExampleIsValid_using_experimental_symbolic_names(EmbeddedFile embedd
public Task ExampleIsValid_extensibility(EmbeddedFile embeddedBicep)
=> RunExampleTest(
embeddedBicep,
new(ExtensibilityEnabled: true, MicrosoftGraphPreviewEnabled: embeddedBicep.StreamPath.Contains("microsoftGraph")),
new(ExtensibilityEnabled: true),
".json");

[DataTestMethod]
Expand Down
11 changes: 1 addition & 10 deletions src/Bicep.Core.IntegrationTests/ProviderImportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -404,19 +404,10 @@ provider mockNs
}

[TestMethod]
public async Task MicrosoftGraph_imports_succeed_with_preview_feature_enabled()
public async Task MicrosoftGraph_imports_succeed_default()
{
var result = await CompilationHelper.RestoreAndCompile(await GetServices(), @"provider microsoftGraph as graph");

result.Should().HaveDiagnostics(new[] {
("BCP204", DiagnosticLevel.Error, "Provider namespace \"microsoftGraph\" is not recognized."),
});

var serviceWithPreview = new ServiceBuilder()
.WithFeatureOverrides(new(TestContext, ExtensibilityEnabled: true, MicrosoftGraphPreviewEnabled: true));

result = await CompilationHelper.RestoreAndCompile(serviceWithPreview, @"provider microsoftGraph as graph");

result.Should().NotHaveAnyDiagnostics();
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Core.IntegrationTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1235,7 +1235,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"experimentalFeaturesEnabled": {
"extensibility": true,
"microsoftGraphPreview": true
"extensibility": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,12 @@ resource group 'Microsoft.Graph/groups@beta' = {
resource appV1 'Microsoft.Graph/applications@v1.0' = {
displayName: 'TestAppV1'
uniqueName: 'testAppV1'

resource myTestFIC 'federatedIdentityCredentials' = {
name: '${appV1.uniqueName}/mytestfic'
audiences: ['audience']
description: 'My test fic'
issuer: 'issuer'
subject: 'subject'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"metadata": {
"_EXPERIMENTAL_WARNING": "This template uses ARM features that are experimental. Experimental features should be enabled for testing purposes only, as there are no guarantees about the quality or stability of these features. Do not enable these settings for any production usage, or your production environment may be subject to breaking.",
"_EXPERIMENTAL_FEATURES_ENABLED": [
"Extensibility",
"MicrosoftGraph Preview"
"Extensibility"
],
"_generator": {
"name": "bicep",
"version": "dev",
"templateHash": "15625412334658089454"
"templateHash": "10094365870369225747"
}
},
"imports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@
"metadata": {
"_EXPERIMENTAL_WARNING": "This template uses ARM features that are experimental. Experimental features should be enabled for testing purposes only, as there are no guarantees about the quality or stability of these features. Do not enable these settings for any production usage, or your production environment may be subject to breaking.",
"_EXPERIMENTAL_FEATURES_ENABLED": [
"Extensibility",
"MicrosoftGraph Preview"
"Extensibility"
],
"_generator": {
"name": "bicep",
"version": "dev",
"templateHash": "9158608803224636845"
"templateHash": "13653571511506928892"
}
},
"parameters": {
Expand All @@ -31,6 +30,22 @@
}
},
"resources": {
"appV1::myTestFIC": {
"import": "graph",
"type": "Microsoft.Graph/applications/federatedIdentityCredentials@v1.0",
"properties": {
"name": "[format('{0}/mytestfic', reference('appV1').uniqueName)]",
"audiences": [
"audience"
],
"description": "My test fic",
"issuer": "issuer",
"subject": "subject"
},
"dependsOn": [
"appV1"
]
},
"resourceApp": {
"import": "graph",
"type": "Microsoft.Graph/applications@beta",
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Core.Samples/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1182,7 +1182,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ public IEnumerable<object[]> GetData(MethodInfo methodInfo)

// TODO: Remove these when they're fixed
private readonly string[] GrandfatheredFeaturesNeedingHelpOrDescription = {
"microsoftGraphPreview",
"providerRegistry",
};
"providerRegistry",
};

private static string GetBicepConfigSchemaContents()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public void GetBuiltInConfiguration_NoParameter_ReturnsBuiltInConfigurationWithA
"assertions": false,
"dynamicTypeLoading": false,
"providerRegistry": false,
"microsoftGraphPreview": false,
"optionalModuleNames": false,
"resourceDerivedTypes": false
},
Expand Down Expand Up @@ -204,7 +203,6 @@ public void GetBuiltInConfiguration_DisableAllAnalyzers_ReturnsBuiltInConfigurat
"assertions": false,
"dynamicTypeLoading": false,
"providerRegistry": false,
"microsoftGraphPreview": false,
"optionalModuleNames": false,
"resourceDerivedTypes": false
},
Expand Down Expand Up @@ -318,7 +316,6 @@ public void GetBuiltInConfiguration_DisableAnalyzers_ReturnsBuiltInConfiguration
"assertions": false,
"dynamicTypeLoading": false,
"providerRegistry": false,
"microsoftGraphPreview": false,
"optionalModuleNames": false,
"resourceDerivedTypes": false
},
Expand Down Expand Up @@ -760,7 +757,6 @@ public void GetConfiguration_ValidCustomConfiguration_OverridesBuiltInConfigurat
"assertions": false,
"dynamicTypeLoading": false,
"providerRegistry": false,
"microsoftGraphPreview": false,
"optionalModuleNames": false,
"resourceDerivedTypes": false
},
Expand Down
3 changes: 0 additions & 3 deletions src/Bicep.Core.UnitTests/Features/FeatureProviderOverrides.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public record FeatureProviderOverrides(
bool? AssertsEnabled = default,
bool? DynamicTypeLoadingEnabled = default,
bool? ProviderRegistry = default,
bool? MicrosoftGraphPreviewEnabled = default,
bool? OptionalModuleNamesEnabled = default,
bool? ResourceDerivedTypesEnabled = default,
string? AssemblyVersion = BicepTestConstants.DevAssemblyFileVersion)
Expand All @@ -37,7 +36,6 @@ public FeatureProviderOverrides(
bool? AssertsEnabled = default,
bool? DynamicTypeLoadingEnabled = default,
bool? ProviderRegistry = default,
bool? MicrosoftGraphPreviewEnabled = default,
bool? OptionalModuleNamesEnabled = default,
bool? ResourceDerivedTypesEnabled = default,
string? AssemblyVersion = BicepTestConstants.DevAssemblyFileVersion
Expand All @@ -54,7 +52,6 @@ public FeatureProviderOverrides(
AssertsEnabled,
DynamicTypeLoadingEnabled,
ProviderRegistry,
MicrosoftGraphPreviewEnabled,
OptionalModuleNamesEnabled,
ResourceDerivedTypesEnabled,
AssemblyVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public OverriddenFeatureProvider(IFeatureProvider features, FeatureProviderOverr

public bool ProviderRegistryEnabled => overrides.ProviderRegistry ?? features.ProviderRegistryEnabled;

public bool MicrosoftGraphPreviewEnabled => overrides.MicrosoftGraphPreviewEnabled ?? features.MicrosoftGraphPreviewEnabled;

public bool OptionalModuleNamesEnabled => overrides.OptionalModuleNamesEnabled ?? features.OptionalModuleNamesEnabled;

public bool ResourceDerivedTypesEnabled => overrides.ResourceDerivedTypesEnabled ?? features.ResourceDerivedTypesEnabled;
Expand Down
6 changes: 3 additions & 3 deletions src/Bicep.Core.UnitTests/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@
},
"Microsoft.Graph.Bicep.Types": {
"type": "Transitive",
"resolved": "0.1.4-preview",
"contentHash": "xKFWkpFUmimbuWB/zQva1e/AFTLlUiirRprqOCp1gWOVMMbF1ciyOl7XZ3rumYHvunSt/O+X2XHczA5sDxYgMQ==",
"resolved": "0.1.5-preview",
"contentHash": "kC8uLcpyb/V4Wy3jDpvk6fF3sPM1B6uAK42zf1Sjwb9RfiNIxCfdCtrpctTxLVenjPQBJA5l0UPGRUHmQKWYmg==",
"dependencies": {
"Azure.Bicep.Types": "0.5.6"
}
Expand Down Expand Up @@ -1187,7 +1187,7 @@
"Microsoft.Extensions.Configuration.Binder": "[8.0.1, )",
"Microsoft.Extensions.Configuration.Json": "[8.0.0, )",
"Microsoft.Extensions.DependencyInjection": "[8.0.0, )",
"Microsoft.Graph.Bicep.Types": "[0.1.4-preview, )",
"Microsoft.Graph.Bicep.Types": "[0.1.5-preview, )",
"Microsoft.PowerPlatform.ResourceStack": "[7.0.0.2007, )",
"Newtonsoft.Json": "[13.0.3, )",
"SharpYaml": "[2.1.1, )",
Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.Core/Bicep.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageReference Include="Microsoft.Graph.Bicep.Types" Version="0.1.4-preview" />
<PackageReference Include="Microsoft.Graph.Bicep.Types" Version="0.1.5-preview" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="Azure.Deployments.Templates" Version="1.0.1243.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public record ExperimentalFeaturesEnabled(
bool Assertions,
bool DynamicTypeLoading,
bool ProviderRegistry,
bool MicrosoftGraphPreview,
bool OptionalModuleNames,
bool ResourceDerivedTypes)
{
Expand Down
9 changes: 0 additions & 9 deletions src/Bicep.Core/CoreResources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/Bicep.Core/CoreResources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,6 @@
<data name="ExperimentalFeatureNames_TestFramework" xml:space="preserve">
<value>Test framework</value>
</data>
<data name="ExperimentalFeatureNames_MicrosoftGraphPreview" xml:space="preserve">
<value>MicrosoftGraph Preview</value>
</data>
<data name="ExperimentalFeatureNames_OptionalModuleNames" xml:space="preserve">
<value>Enable optional module names</value>
</data>
Expand Down
2 changes: 0 additions & 2 deletions src/Bicep.Core/Features/FeatureProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ public FeatureProvider(RootConfiguration configuration)

public bool AssertsEnabled => configuration.ExperimentalFeaturesEnabled.Assertions;

public bool MicrosoftGraphPreviewEnabled => this.configuration.ExperimentalFeaturesEnabled.MicrosoftGraphPreview;

public static bool TracingEnabled => ReadBooleanEnvVar("BICEP_TRACING_ENABLED", defaultValue: false);

public static TraceVerbosity TracingVerbosity => ReadEnumEnvVar("BICEP_TRACING_VERBOSITY", TraceVerbosity.Basic);
Expand Down
2 changes: 0 additions & 2 deletions src/Bicep.Core/Features/IFeatureProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public interface IFeatureProvider

bool AssertsEnabled { get; }

bool MicrosoftGraphPreviewEnabled { get; }

bool OptionalModuleNamesEnabled { get; }

Expand All @@ -49,7 +48,6 @@ public interface IFeatureProvider
(ProviderRegistryEnabled, CoreResources.ExperimentalFeatureNames_ProviderRegistry, true, false),
(TestFrameworkEnabled, CoreResources.ExperimentalFeatureNames_TestFramework, false, false),
(AssertsEnabled, CoreResources.ExperimentalFeatureNames_Asserts, true, true),
(MicrosoftGraphPreviewEnabled, CoreResources.ExperimentalFeatureNames_MicrosoftGraphPreview, true, true),
(OptionalModuleNamesEnabled, CoreResources.ExperimentalFeatureNames_OptionalModuleNames, true, false),
(ResourceDerivedTypesEnabled, CoreResources.ExperimentalFeatureNames_ResourceDerivedTypes, true, false),
})
Expand Down
5 changes: 0 additions & 5 deletions src/Bicep.Core/Semantics/Namespaces/NamespaceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,6 @@ private TypeSymbol GetNamespaceTypeForConfigManagedProvider(

if (LanguageConstants.IdentifierComparer.Equals(providerName, MicrosoftGraphNamespaceType.BuiltInName))
{
if (!features.MicrosoftGraphPreviewEnabled)
{
return ErrorType.Create(diagBuilder.UnrecognizedProvider(providerName));
}

return MicrosoftGraphNamespaceType.Create(aliasName);
}

Expand Down
Loading

0 comments on commit 89e2582

Please sign in to comment.