Skip to content

Added rs vault backup changes for get vault credential file cmdlet #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.Compute" Version="49.2.0" />
<PackageReference Include="Microsoft.Azure.Management.Network" Version="21.0.0" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.3-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.2.0-preview" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.2-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices" Version="4.3.3-preview" />
<PackageReference Include="Microsoft.Azure.Management.RecoveryServices.Backup" Version="4.2.0-preview" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,27 @@ public class RSBackupVaultAADCreds
public string AadTenantId { get; set; }

/// <summary>
/// Gets or sets the Service Principal Client Id.
/// Gets or sets the values for AadAudience.
/// </summary>
[DataMember(Order = 11)]
public string ServicePrincipalClientId { get; set; }
public string AadAudience { get; set; }

/// <summary>
/// Gets or sets the Id Management Endpoint.
/// Gets or sets the Service Principal Client Id.
/// </summary>
[DataMember(Order = 12)]
public string IdMgmtRestEndpoint { get; set; }
public string ServicePrincipalClientId { get; set; }

/// <summary>
/// Gets or sets the agent links
/// Gets or sets the Id Management Endpoint.
/// </summary>
[DataMember(Order = 13)]
public string AgentLinks { get; set; }
public string IdMgmtRestEndpoint { get; set; }

/// <summary>
/// Gets or sets the values for AadAudience.
/// Gets or sets the agent links
/// </summary>
[DataMember(Order = 14)]
public string AadAudience { get; set; }
public string AgentLinks { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,16 @@ private string GenerateVaultCredsForBackup(string subscriptionId,
{
var aadDetails = vaultCertificateResponse.Properties as ResourceCertificateAndAadDetails;

string aadAudience = aadDetails.AadAudience;
if (string.IsNullOrEmpty(aadAudience))
{
aadAudience = string.Format(CultureInfo.InvariantCulture,
@"https://RecoveryServiceVault/{0}/{1}/{2}",
Vault.Location,
Vault.Name,
aadDetails.ResourceId);
}

var vaultCreds = new RSBackupVaultAADCreds
{
SubscriptionId = subscriptionId,
Expand All @@ -562,15 +572,15 @@ private string GenerateVaultCredsForBackup(string subscriptionId,
ResourceId = aadDetails.ResourceId.Value,
AadAuthority = aadDetails.AadAuthority,
AadTenantId = aadDetails.AadTenantId,
AadAudience = aadAudience,
ServicePrincipalClientId = aadDetails.ServicePrincipalClientId,
IdMgmtRestEndpoint = aadDetails.AzureManagementEndpointAudience,
ProviderNamespace = PSRecoveryServicesClient.ProductionRpNamespace,
ResourceGroup = Vault.ResourceGroupName,
Location = Vault.Location,
Version = VaultCredentialVersionAad,
ResourceType = RecoveryServicesVaultType,
AgentLinks = GetAgentLinks(),
AadAudience = aadDetails.AadAudience
AgentLinks = GetAgentLinks()
};

var serializer = new DataContractSerializer(typeof(RSBackupVaultAADCreds));
Expand Down